How to split an ansible local_action in multiple lines
I have a local_action the I would like to split in multiple lines.
- name: Find geographical region of this server
local_action: uri url=http://locator/studio/{{ ansible_default_ipv4.address}} method=GET return_content=yes register=locator_output
The task is defined using shorthand syntax
. The same result could be achieved by using the regular syntax and delegate_to
parameter, like this:
- name: Find geographical region of this server
uri:
url: http://locator/studio/{{ ansible_default_ipv4.address}}
method: GET
return_content: yes
register: locator_output
delegate_to: localhost
The solution is to use module
parameter with the original action name:
- name: Find geographical region of this server
local_action:
module: uri
url: http://locator/studio/{{ ansible_default_ipv4.address}}
method: GET
return_content: yes
register: locator_output