Skip to content

Ansible - Ad-Hoc

Commands

Connectivity test:

ansible -m ping all

Run local script on remote server:

ansible -m script -a {script} all
# Ex: ansible -m script -a script.sh all

Run shell on remote server:

ansible -m shell -a "{command}" all
# Ex: ansible -m shell -a "ls -l" all

Get config from a host (Gathering facts):

ansible -m setup all
  • https://www.middlewareinventory.com/blog/ansible-ad-hoc-commands/
Back to top