Ansible - Run tasks on the control node

By default, certain tasks will be run on the control node (that's your Ansible server) or on your managed nodes (the target systems). For example:

  • Lookup is run on the control node
  • Modules are run on your managed nodes

There are different ways to modify this behavior. The following can be used to invoke a module on the control node (that's your Ansible server). 

Or, it you can set -hosts: localhost in your playbook to run the playbook against the control node.

---
- hosts: localhost
  tasks:
  - debug:
      msg: Hello World
...

 



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 670e9 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   |