Ansible - ansible ad hoc --args command

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"

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |