Skip to content
Snippets Groups Projects
Commit 79dec8da authored by Chris Hines's avatar Chris Hines
Browse files

update the process for generating the /etc/hosts file to make it more robust

parent 3c2d0c72
No related branches found
No related tags found
1 merge request!53update the process for generating the /etc/hosts file to make it more robust
...@@ -25,10 +25,12 @@ for group in d['groups'].keys(): ...@@ -25,10 +25,12 @@ for group in d['groups'].keys():
for h in hosts.keys(): for h in hosts.keys():
if d['hostvars'].has_key(h): if d['hostvars'].has_key(h):
string="%s"%(d['hostvars'][h]['ansible_eth0']['ipv4']['address']) for addr in d['hostvars'][h]['ansible_all_ipv4_addresses']:
for name in hosts[h]: if "172.16.200" in addr:
string=string+" %s"%(name) string="%s"%addr
print string for name in hosts[h]:
string=string+" %s"%(name)
print string
for h in hosts.keys(): for h in hosts.keys():
if d['hostvars'].has_key(h): if d['hostvars'].has_key(h):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment