Ansible local_action directive

后端 未结 2 1000
清酒与你
清酒与你 2021-02-19 02:12

I\'m quite new to Ansible and have a simple question for my understanding of local_action directive.

Would that mean that the command is fully executed loca

2条回答
  •  情话喂你
    2021-02-19 03:14

    Yes, local_action is an alternative way of doing delegate_to: localhost.

    These actions will be executed on local machine (Ansible control host), but still being in context of remote host in terms of variables. So you can something like this:

    local_action: command ping -c 1 {{ inventory_hostname }}
    

    which will ping every host in your play, but ping will be initiated from Ansible control host.

提交回复
热议问题