Dear all,
I have recently upgraded to ansible 1.3.2 from the release/1.3.2 branch. This upgrade broke my playbooks.
git bisect identified commit 576962d as the first bad commit. This commit changes the number of forks in relation to the number of hosts. As it turns out, this commit did not introduce the bug I encountered, but merely unmasked it.
Unfortunately, the most reduced example I managed to create is not really minimal. At the end of the post there’s a script to create the files I mention here, so that you can easily reproduce the problem. Note that you will need to set hash_behaviour = merge In your ansible.cfg:
hosts:
[vm_servers]
127.0.0.2
[vm_guests]
127.0.0.3
127.0.0.4
host_vars/127.0.0.3:
name: srv
vm:
host_system: 127.0.0.2
host_vars/127.0.0.4:
name: srx
vm:
host_system: 127.0.0.2
site.yml:
- include: role.vm.yml
role.vm.yml:
- hosts: vm_guests
vars_files: - “roles/vm/vars/{{ name }}.yml”
roles: - vm
roles/vm/vars/srv.yml
vm:
foo: bar
roles/vm/vars/srx.yml
vm:
foo: baz
roles/vm/tasks/main.yml
-
name: delegation pass
action: shell hostname -f
delegate_to: “{{ vm.host_system }}” -
name: template upload
action: template src=test.j2 dest=/tmp/test.txt -
name: delegation fail
action: shell hostname -f
delegate_to: “{{ vm.host_system }}”
roles/vm/templates/test.j2
{%- for host in groups[‘vm_guests’] -%}
{{ hostvars[host][‘name’] }}
{%- endfor %}
With ansible 1.3.2, the playbook works like expected when called with:
$ ansible-playbook site.yml -i hosts
If I limit the number of forks to exactly 1, execution aborts with an error:
$ ansible-playbook site.yml -i hosts -vvvv --forks 1
…
TASK: [delegation pass]