Hi,

  I want to create host file with following requirements 


My inventory file

[hadoop:children]
hadoop-master
hadoop-slave
hadoop-gateway

[hadoop-master]
hnn001.test.abc.com
hnn002.test.abc.com

[hadoop-slave]
hdp001.test.abc.com
hdp002.test.abc.com
hdp003.test.abc.com
hdp004.test.abc.com
hdp005.test.abc.com
hdp006.test.abc.com

[hadoop-gateway]
hadoop-client01.test.abc.com


My task (got from https://gist.github.com/rothgar/8793800) :

- name: Update /etc/hosts
  lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ 
hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
  when: hostvars[item].ansible_default_ipv4.address is defined
  with_items: groups['hadoop'] 


but here I need to run playbook on the group (hadoop), how can I just run 
on group children (hadoop-master, hadoop-slave, hadoop-gateway) or just one 
of the host & still get host entry for all hosts in the group.

any idea how to do that in ansible ?

Thanks

-- 
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/756c2251-2941-49da-b406-4d4336c317d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to