How to split an ansible local_action in multiple lines

ansibleansible-playbook

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

Best Answer

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