Hi,
I want to create host file with following requirements
My inventory file
[hadoop:children]
hadoop-master
hadoop-slave
hadoop-gateway
[hadoop-master]
[hadoop-slave]
[hadoop-gateway]
- 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