Authored by chunhua.zhang

add

@@ -4,6 +4,16 @@ @@ -4,6 +4,16 @@
4 4
5 5
6 6
  7 +[java-wechat]
  8 +10.66.70.139
  9 +10.66.70.12
  10 +
  11 +
  12 +[java-erpgateway]
  13 +10.66.50.140
  14 +10.66.50.113
  15 +
  16 +
7 [java-promotion] 17 [java-promotion]
8 10.66.70.41 18 10.66.70.41
9 10.66.70.170 19 10.66.70.170
@@ -19,6 +29,17 @@ @@ -19,6 +29,17 @@
19 10.66.70.96 29 10.66.70.96
20 30
21 31
  32 +[java-union]
  33 +10.66.70.21
  34 +10.66.70.49
  35 +10.66.103.20
  36 +
  37 +
  38 +[java-brower]
  39 +10.66.70.223
  40 +10.66.70.42
  41 +
  42 +
22 [java-message] 43 [java-message]
23 10.66.70.100 44 10.66.70.100
24 10.66.70.109 45 10.66.70.109
@@ -46,3 +67,8 @@ @@ -46,3 +67,8 @@
46 10.66.70.9 67 10.66.70.9
47 10.66.70.128 68 10.66.70.128
48 69
  70 +
  71 +[java-activity]
  72 +10.66.70.89
  73 +10.66.70.142
  74 +
1 -[java-nginx]  
2 -10.66.104.15  
3 -10.66.104.13  
4 -  
5 -  
6 -  
7 -[java-promotion]  
8 -10.66.104.16  
9 -10.66.104.41  
10 -  
11 -  
12 -[java-sns]  
13 -10.66.104.12  
14 -10.66.104.48  
15 -  
16 -  
17 -[java-product]  
18 -10.66.104.12  
19 -10.66.104.48  
20 -  
21 -  
22 -[java-message]  
23 -10.66.104.12  
24 -10.66.104.48  
25 -  
26 -  
27 -[java-order]  
28 -10.66.104.16  
29 -10.66.104.41  
30 -  
31 -  
32 -[java-gateway]  
33 -10.66.104.2  
34 -10.66.104.44  
35 -10.66.104.28  
36 -10.66.104.29  
37 -  
38 -  
39 -[java-users]  
40 -10.66.104.10  
41 -10.66.104.43  
42 -  
43 -  
44 -[java-resources]  
45 -10.66.104.10  
46 -10.66.104.43  
47 -  
@@ -4,6 +4,16 @@ @@ -4,6 +4,16 @@
4 4
5 5
6 6
  7 +[java-wechat]
  8 +10.66.104.7
  9 +10.66.104.39
  10 +
  11 +
  12 +[java-erpgateway]
  13 +10.66.104.7
  14 +10.66.104.39
  15 +
  16 +
7 [java-promotion] 17 [java-promotion]
8 10.66.104.16 18 10.66.104.16
9 10.66.104.41 19 10.66.104.41
@@ -19,6 +29,17 @@ @@ -19,6 +29,17 @@
19 10.66.104.48 29 10.66.104.48
20 30
21 31
  32 +[java-union]
  33 +10.66.70.21
  34 +10.66.70.49
  35 +10.66.103.20
  36 +
  37 +
  38 +[java-brower]
  39 +10.66.104.7
  40 +10.66.104.39
  41 +
  42 +
22 [java-message] 43 [java-message]
23 10.66.104.12 44 10.66.104.12
24 10.66.104.48 45 10.66.104.48
@@ -45,3 +66,8 @@ @@ -45,3 +66,8 @@
45 10.66.104.10 66 10.66.104.10
46 10.66.104.43 67 10.66.104.43
47 68
  69 +
  70 +[java-activity]
  71 +10.66.104.17
  72 +10.66.104.26
  73 +
@@ -3,6 +3,16 @@ @@ -3,6 +3,16 @@
3 10.66.202.12 3 10.66.202.12
4 4
5 5
  6 +[java-wechat]
  7 +10.66.202.7
  8 +10.66.202.32
  9 +
  10 +
  11 +[java-erpgateway]
  12 +10.66.202.7
  13 +10.66.202.32
  14 +
  15 +
6 [java-promotion] 16 [java-promotion]
7 10.66.202.16 17 10.66.202.16
8 10.66.202.47 18 10.66.202.47
@@ -18,6 +28,17 @@ @@ -18,6 +28,17 @@
18 10.66.202.39 28 10.66.202.39
19 29
20 30
  31 +[java-union]
  32 +10.66.70.21
  33 +10.66.70.49
  34 +10.66.103.20
  35 +
  36 +
  37 +[java-brower]
  38 +10.66.202.7
  39 +10.66.202.32
  40 +
  41 +
21 [java-message] 42 [java-message]
22 10.66.202.17 43 10.66.202.17
23 10.66.202.39 44 10.66.202.39
@@ -43,3 +64,8 @@ @@ -43,3 +64,8 @@
43 10.66.202.11 64 10.66.202.11
44 10.66.202.21 65 10.66.202.21
45 66
  67 +
  68 +[java-activity]
  69 +10.66.202.14
  70 +10.66.202.41
  71 +
1 # Role on galaxy 1 # Role on galaxy
2 -- you.rolename 2 +
3 # Public role on github 3 # Public role on github
4 -- name: role-public  
5 - src: https://github.com/erasme/role-public.git  
6 -# Private role on github  
7 -- name: role-private  
8 - src: git+ssh://git@github.com/you/role-private.git  
  4 +
  5 +- name: auto-generate inventory files
@@ -10,7 +10,7 @@ import json @@ -10,7 +10,7 @@ import json
10 import os 10 import os
11 from subprocess import call 11 from subprocess import call
12 from jinja2 import Environment, PackageLoader 12 from jinja2 import Environment, PackageLoader
13 - 13 +import collections
14 14
15 # clone deploy project to local 15 # clone deploy project to local
16 HOME = os.path.expanduser("~") 16 HOME = os.path.expanduser("~")
@@ -32,7 +32,12 @@ host_group = { "yoho_gateway": "java-gateway", @@ -32,7 +32,12 @@ host_group = { "yoho_gateway": "java-gateway",
32 "yohobuy_promotion": "java-promotion", 32 "yohobuy_promotion": "java-promotion",
33 "yohobuy_product": "java-product", 33 "yohobuy_product": "java-product",
34 "yoho_message": "java-message", 34 "yoho_message": "java-message",
35 - "yoho_sns": "java-sns" 35 + "yoho_sns": "java-sns",
  36 + "yohobuy_brower": "java-brower",
  37 + "yohobuy_activity": "java-activity",
  38 + "yoho_erp_gateway": "java-erpgateway",
  39 + "yohobuy_wechat": "java-wechat",
  40 + "yohobuy_union": "java-union"
36 } 41 }
37 # all available zone groups 42 # all available zone groups
38 all_groups = {} 43 all_groups = {}
@@ -69,8 +74,9 @@ for _az in azs_mappings.keys(): @@ -69,8 +74,9 @@ for _az in azs_mappings.keys():
69 file = open(hosts, 'w') 74 file = open(hosts, 'w')
70 75
71 #write template 76 #write template
  77 + sorted_dict = collections.OrderedDict(sorted(all_groups[az].keys()))
72 template = env.get_template('inventory-%s.j2' % az) 78 template = env.get_template('inventory-%s.j2' % az)
73 - file.write(template.render(groups = all_groups[az])) 79 + file.write(template.render(groups = sorted_dict ))
74 file.close() 80 file.close()
75 81
76 82