diff --git a/roles/calculateEtcHosts/files/makehosts.py b/roles/calculateEtcHosts/files/makehosts.py index b56e2817b93eda2b56fc701175265892bba86115..724d0530b1d806a05a9f2e200223eed549c09daa 100755 --- a/roles/calculateEtcHosts/files/makehosts.py +++ b/roles/calculateEtcHosts/files/makehosts.py @@ -25,10 +25,12 @@ for group in d['groups'].keys(): for h in hosts.keys(): if d['hostvars'].has_key(h): - string="%s"%(d['hostvars'][h]['ansible_eth0']['ipv4']['address']) - for name in hosts[h]: - string=string+" %s"%(name) - print string + for addr in d['hostvars'][h]['ansible_all_ipv4_addresses']: + if "172.16.200" in addr: + string="%s"%addr + for name in hosts[h]: + string=string+" %s"%(name) + print string for h in hosts.keys(): if d['hostvars'].has_key(h):