delegate_to a list does not appear to work in a role

529 views
Skip to first unread message

Stewart M

unread,
May 29, 2014, 3:51:54 PM5/29/14
to ansible...@googlegroups.com
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?

Michael DeHaan

unread,
May 31, 2014, 12:17:44 PM5/31/14
to ansible...@googlegroups.com
This sounds like it could be related to https://github.com/ansible/ansible/issues/7535 ... please see if it is the same.




--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
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.

Stewart M

unread,
Jun 4, 2014, 12:04:10 PM6/4/14
to ansible...@googlegroups.com
Many thanks for the pointer to that bug. Pulling ansible 1.7 (devel d9df607972) seems to have cleared the issue and all is working as I had hoped, so it does look like it was a related issue.
Reply all
Reply to author
Forward
0 new messages