I appear to be having a problem when trying to pass a list of hosts to 
delegate_to, within a role.

(Simplified examples to demonstrate the behavior I am seeing, using freshly 
cloned version from Github)

This works as expected:

*site.yml*

---

- name: test delegation
  hosts: delegator.example.com
  sudo: yes
  tasks:
    - name: delegate a task
      command: /bin/date
      delegate_to: "{{ item }}"
      with_items: 
        - delegate1.example.com
        - delegate2.example.com




This does not:

*site.yml*

- name: test delegation
  hosts: delegator.example.com
  sudo: yes
  roles:
    - delegator



*roles/delegator/tasks/main.yml*

---

- name: delegate a task
  command: /bin/date
  delegate_to: "{{ item }}"
  with_items: 
    - delegate1.example.com
    - delegate2.example.com



failing with:

fatal: [delegator.example.com] => SSH Error: data could not be sent to the 
remote host. Make sure this host can be reached over ssh


Ideally, the list will come from somewhere else in actual use, but again, 
keeping it simple to demonstrate the problem.

Is this the expected behavior for delegation within a role, or am I doing 
it wrong, or is Ansible doing it wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e2ddacec-d515-46fe-a90a-277c155a02ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to