Как разбить ANSIBLE 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

2 ответа

Решение

Задача определяется с помощью 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

Решение заключается в использовании 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
Другие вопросы по тегам