Hi,
Is the use of delegate_to with with_items supposed to work ?
$ ansible --version
ansible 2.0.1.0
config file = /vagrant/sysadmin/ansible/atlassian/ansible.cfg
configured module search path = /usr/local/share/ansible_modules/
Using the following playbook show that it always delegate to the first
item, is it a bug ?
---
- hosts: localhost
tasks:
- shell: hostname -f
delegate_to: "{{ item }}"
with_items:
- server1
- server2
$ ansible-playbook test.yml -vv
Using /vagrant/sysadmin/ansible/atlassian/ansible.cfg as config file
[WARNING]: provided hosts list is empty, only localhost is available
1 plays in test.yml
PLAY
***************************************************************************
TASK [setup]
*******************************************************************
Tuesday 24 May 2016 16:28:43 +0200 (0:00:00.034) 0:00:00.034
***********
ok: [localhost]
TASK [command]
*****************************************************************
task path: /vagrant/sysadmin/ansible/atlassian/test.yml:5
Tuesday 24 May 2016 16:28:43 +0200 (0:00:00.247) 0:00:00.282
***********
changed: [localhost -> server1] => (item=server1) => {"changed": true, "cmd"
: "hostname -f", "delta": "0:00:00.013899", "end": "2016-05-24
16:28:50.279268", "item": "server1", "rc": 0, "start": "2016-05-24
16:28:50.265369", "stderr": "", "stdout": "server1", "stdout_lines": ["
server1"], "warnings": []}
changed: [localhost -> server2] => (item=server2) => {"changed": true, "cmd"
: "hostname -f", "delta": "0:00:00.009186", "end": "2016-05-24
16:28:50.695290", "item": "server2", "rc": 0, "start": "2016-05-24
16:28:50.686104", "stderr": "", "stdout": "server1", "stdout_lines": ["
server1"], "warnings": []}
PLAY RECAP
*********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
Tuesday 24 May 2016 16:28:50 +0200 (0:00:06.694) 0:00:06.976
***********
===============================================================================
TASK: command -----------------------------------------------------------
6.69s
TASK: setup -------------------------------------------------------------
0.25s
Playbook run took 0 days, 0 hours, 0 minutes, 6 seconds
It looks like it connects to the two servers but the output of the hostname
command shows that it connects twice to the first server...
regards,
Julien.
--
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/c7a8f25a-db2e-45d7-a417-c4019048d5b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.