- name: Add instance to new host group
add_host:
name: "{{ item }}"
group: zk
with_items:
- server1
- server2
- server3
- name: deploy to zk group
hosts: zk
tasks:
- name: write a myid file based on the position in the group
copy:
content: {{ some_magic_variable?????? }}
dest: /zookeeper-data/myid
In the above server i would expect to end up with three servers each with a myid file that contains 0, 1 or 2
Anyone know if that magic variable exists?
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[my-hosts]
192.168.1.1
192.168.1.1
192.168.1.1
192.168.1.1
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.