...
|
...
|
@@ -73,8 +73,8 @@ for _az in azs_mappings.keys(): |
|
|
call("mv %s %s" % (hosts, os.path.join("./inventories", az, "hosts.bak")), shell=True)
|
|
|
file = open(hosts, 'w')
|
|
|
|
|
|
#write template
|
|
|
sorted_dict = collections.OrderedDict(sorted(all_groups[az].keys()))
|
|
|
#write template, sort the dict by key
|
|
|
sorted_dict = collections.OrderedDict(sorted(all_groups[az].items(), key=lambda t: t[0]))
|
|
|
template = env.get_template('inventory-%s.j2' % az)
|
|
|
file.write(template.render(groups = sorted_dict ))
|
|
|
file.close()
|
...
|
...
|
|