Authored by chunhua.zhang

按照key排序

... ... @@ -4,9 +4,14 @@
[java-wechat]
10.66.70.139
10.66.70.12
[java-activity]
10.66.70.89
10.66.70.142
[java-brower]
10.66.70.223
10.66.70.42
[java-erpgateway]
... ... @@ -14,17 +19,40 @@
10.66.50.113
[java-promotion]
[java-gateway]
10.66.70.22
10.66.70.204
10.66.0.240
10.66.0.4
10.66.0.5
[java-message]
10.66.70.100
10.66.70.109
[java-order]
10.66.70.41
10.66.70.170
[java-sns]
[java-product]
10.66.70.47
10.66.70.96
[java-product]
[java-promotion]
10.66.70.41
10.66.70.170
[java-resources]
10.66.70.9
10.66.70.128
[java-sns]
10.66.70.47
10.66.70.96
... ... @@ -35,40 +63,12 @@
10.66.103.20
[java-brower]
10.66.70.223
10.66.70.42
[java-message]
10.66.70.100
10.66.70.109
[java-order]
10.66.70.41
10.66.70.170
[java-gateway]
10.66.70.22
10.66.70.204
10.66.0.240
10.66.0.4
10.66.0.5
[java-users]
10.66.70.9
10.66.70.128
[java-resources]
10.66.70.9
10.66.70.128
[java-activity]
10.66.70.89
10.66.70.142
[java-wechat]
10.66.70.139
10.66.70.12
... ...
... ... @@ -4,19 +4,27 @@
[java-promotion]
10.66.70.41
10.66.70.170
[java-activity]
10.66.70.89
10.66.70.142
[java-sns]
10.66.70.47
10.66.70.96
[java-brower]
10.66.70.223
10.66.70.42
[java-product]
10.66.70.47
10.66.70.96
[java-erpgateway]
10.66.50.140
10.66.50.113
[java-gateway]
10.66.70.22
10.66.70.204
10.66.0.240
10.66.0.4
10.66.0.5
[java-message]
... ... @@ -29,20 +37,38 @@
10.66.70.170
[java-gateway]
10.66.70.22
10.66.70.204
10.66.0.240
10.66.0.4
10.66.0.5
[java-product]
10.66.70.47
10.66.70.96
[java-users]
[java-promotion]
10.66.70.41
10.66.70.170
[java-resources]
10.66.70.9
10.66.70.128
[java-resources]
[java-sns]
10.66.70.47
10.66.70.96
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-users]
10.66.70.9
10.66.70.128
[java-wechat]
10.66.70.139
10.66.70.12
... ...
[java-nginx]
10.66.104.15
10.66.104.13
[java-activity]
10.66.104.17
10.66.104.26
[java-brower]
10.66.104.7
10.66.104.39
[java-erpgateway]
10.66.104.7
10.66.104.39
[java-gateway]
10.66.104.2
10.66.104.44
10.66.104.28
10.66.104.29
[java-message]
10.66.104.12
10.66.104.48
[java-order]
10.66.104.16
10.66.104.41
[java-product]
10.66.104.12
10.66.104.48
[java-promotion]
10.66.104.16
10.66.104.41
[java-resources]
10.66.104.10
10.66.104.43
[java-sns]
10.66.104.12
10.66.104.48
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-users]
10.66.104.10
10.66.104.43
[java-wechat]
10.66.104.7
10.66.104.39
... ...
... ... @@ -4,7 +4,12 @@
[java-wechat]
[java-activity]
10.66.104.17
10.66.104.26
[java-brower]
10.66.104.7
10.66.104.39
... ... @@ -14,47 +19,47 @@
10.66.104.39
[java-promotion]
10.66.104.16
10.66.104.41
[java-gateway]
10.66.104.2
10.66.104.44
10.66.104.28
10.66.104.29
[java-sns]
[java-message]
10.66.104.12
10.66.104.48
[java-order]
10.66.104.16
10.66.104.41
[java-product]
10.66.104.12
10.66.104.48
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-promotion]
10.66.104.16
10.66.104.41
[java-brower]
10.66.104.7
10.66.104.39
[java-resources]
10.66.104.10
10.66.104.43
[java-message]
[java-sns]
10.66.104.12
10.66.104.48
[java-order]
10.66.104.16
10.66.104.41
[java-gateway]
10.66.104.2
10.66.104.44
10.66.104.28
10.66.104.29
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-users]
... ... @@ -62,12 +67,7 @@
10.66.104.43
[java-resources]
10.66.104.10
10.66.104.43
[java-activity]
10.66.104.17
10.66.104.26
[java-wechat]
10.66.104.7
10.66.104.39
... ...
... ... @@ -3,7 +3,12 @@
10.66.202.12
[java-wechat]
[java-activity]
10.66.202.14
10.66.202.41
[java-brower]
10.66.202.7
10.66.202.32
... ... @@ -13,46 +18,46 @@
10.66.202.32
[java-promotion]
10.66.202.16
10.66.202.47
[java-gateway]
10.66.202.13
10.66.202.15
10.66.202.8
[java-sns]
[java-message]
10.66.202.17
10.66.202.39
[java-order]
10.66.202.16
10.66.202.47
[java-product]
10.66.202.17
10.66.202.39
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-promotion]
10.66.202.16
10.66.202.47
[java-brower]
10.66.202.7
10.66.202.32
[java-resources]
10.66.202.11
10.66.202.21
[java-message]
[java-sns]
10.66.202.17
10.66.202.39
[java-order]
10.66.202.16
10.66.202.47
[java-gateway]
10.66.202.13
10.66.202.15
10.66.202.8
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-users]
... ... @@ -60,12 +65,7 @@
10.66.202.21
[java-resources]
10.66.202.11
10.66.202.21
[java-activity]
10.66.202.14
10.66.202.41
[java-wechat]
10.66.202.7
10.66.202.32
... ...
... ... @@ -3,19 +3,25 @@
10.66.202.12
[java-promotion]
10.66.202.16
10.66.202.47
[java-activity]
10.66.202.14
10.66.202.41
[java-sns]
10.66.202.17
10.66.202.39
[java-brower]
10.66.202.7
10.66.202.32
[java-product]
10.66.202.17
10.66.202.39
[java-erpgateway]
10.66.202.7
10.66.202.32
[java-gateway]
10.66.202.13
10.66.202.15
10.66.202.8
[java-message]
... ... @@ -28,18 +34,38 @@
10.66.202.47
[java-gateway]
10.66.202.13
10.66.202.15
10.66.202.8
[java-product]
10.66.202.17
10.66.202.39
[java-users]
[java-promotion]
10.66.202.16
10.66.202.47
[java-resources]
10.66.202.11
10.66.202.21
[java-resources]
[java-sns]
10.66.202.17
10.66.202.39
[java-union]
10.66.70.21
10.66.70.49
10.66.103.20
[java-users]
10.66.202.11
10.66.202.21
[java-wechat]
10.66.202.7
10.66.202.32
... ...
... ... @@ -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()
... ...