As per the Ansible documentation:
An ad-hoc command is something that you might type in to do something really quick, but don’t want to save for later.
For example, if you want to you can test a module, (e.g IOS_Facts), without having to write a Playbook by using Ad-Hoc commands such as this:
ansible all -i 192.168.0.210, -c local -m ios_facts -a "host=192.168.0.210 username=cisco password=cisco gather_subset=hardware"
Here is another example, this time using the IOS_command module:
ansible all -i 192.168.0.210, -c local -m ios_command -a "host=192.168.0.210 username=cisco password=cisco auth_pass=cisco authorize=true commands='show run'"
As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at will@oznetnerd.com, or drop me a message on Reddit (OzNetNerd).
Note: The opinions expressed in this blog are my own and not those of my employer.
Leave a comment