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
  - debug:
      msg: Hello World


Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

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 703da in the box below so that we can be sure you are a human.