Ansible - ansible ad hoc --args command

by
Jeremy Canfield |
Updated: March 22 2021
| Ansible articles
The ansible ad-hoc command with the -a or --args option can be used to:
- Invoke a native Linux command on managed nodes
- Invoke a module on managed nodes
In this example, all managed nodes in your default hosts file or your own inventory file will be immediately restarted.
ansible all --args "/sbin/reboot now"
In this example, the yum module is used to update all managed nodes in your default hosts file or your own inventory file.
ansible all --module-name yum --args "name='*' state=latest"
Did you find this article helpful?
If so, consider buying me a coffee over at