如何在多行中分割一个可靠的local_action

我有一个local_action我想分成多行。

- 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 

该任务使用shorthand syntax来定义。 使用常规语法和delegate_to参数可以实现相同的结果,如下所示:

 - 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 

解决scheme是使用module参数与原始操作名称:

  - 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