FreeKB - Ansible local_action parameter
Ansible - local_action parameter

The local_action parameter can be used to run a task on the control node (that's your Ansible server). Some (but not all) modules will also accept the connection and/or delegate_to modules to run the task on the control node. 

In this example, the file module is used to remove a file on the control node.

- name: "remove foo.txt on control node"
  local_action:
    module: "file"
    path: "/tmp/foo.txt"
    state: "absent"

 

Running this task should produce the following.

TASK [remove foo.txt on control node] 
changed: [server1.example.com -> localhost]

 



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 e6d82 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   |