Bootstrap FreeKB - Ansible - ansible ad hoc --args command
Ansible - ansible ad hoc --args command

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter 8198aa in the box below so that we can be sure you are a human.