diff --git a/roles/calculateEtcHosts/files/makehosts.py b/roles/calculateEtcHosts/files/makehosts.py index fa830d92bc5dbc768a462fe87750a35f92d542c2..208e402a9448b636dd1f61f9d2bb0c7229fc6184 100755 --- a/roles/calculateEtcHosts/files/makehosts.py +++ b/roles/calculateEtcHosts/files/makehosts.py @@ -16,10 +16,11 @@ hosts={} for group in d['groups'].keys(): i=0 for h in d['groups'][group]: + name = d['hostsvars'][h]['ansible_hostname'] if not domain: - hosts[h] = [h] + hosts[h] = [name] else: - hosts[h] = ['%s.%s %s'%(h,domain,h)] + hosts[h] = ['%s.%s %s'%(name,domain,name)] for h in hosts.keys(): if d['hostvars'].has_key(h):