From 1ffae5623338f64824b7de72500ad8a37540d3f7 Mon Sep 17 00:00:00 2001 From: Jupiter Hu <jupiter.hu@monash.edu> Date: Mon, 1 Aug 2016 13:54:31 +1000 Subject: [PATCH] Fixed calculate etc hosts Former-commit-id: ae00fb8006084b315b1cbe66f1db6a7cc87779d8 --- roles/calculateEtcHosts/files/makehosts.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/calculateEtcHosts/files/makehosts.py b/roles/calculateEtcHosts/files/makehosts.py index 724d0530..5f9cd42f 100755 --- a/roles/calculateEtcHosts/files/makehosts.py +++ b/roles/calculateEtcHosts/files/makehosts.py @@ -32,6 +32,13 @@ for h in hosts.keys(): string=string+" %s"%(name) print string +for h in hosts.keys(): + if d['hostvars'].has_key(h): + string="%s"%(d['hostvars'][h]['ansible_default_ipv4']['address']) + for name in hosts[h]: + string=string+" %s"%(name) + print string + for h in hosts.keys(): if d['hostvars'].has_key(h): if d['hostvars'][h].has_key('ansible_tun0'): -- GitLab