Authored by chunhua.zhang

添加了uic的 inventory 文件

@@ -63,6 +63,11 @@ @@ -63,6 +63,11 @@
63 10.66.70.96 63 10.66.70.96
64 64
65 65
  66 +[java-uic]
  67 +10.66.70.223
  68 +10.66.70.42
  69 +
  70 +
66 [java-union] 71 [java-union]
67 10.66.70.21 72 10.66.70.21
68 10.66.70.49 73 10.66.70.49
  1 +# inventory file for az1
  2 +
  3 +[nameservers]
  4 +10.66.4.18
  5 +10.66.4.17
  6 +
1 [java-nginx] 7 [java-nginx]
2 10.66.0.2 8 10.66.0.2
3 10.66.0.3 9 10.66.0.3
@@ -57,6 +63,11 @@ @@ -57,6 +63,11 @@
57 10.66.70.96 63 10.66.70.96
58 64
59 65
  66 +[java-uic]
  67 +10.66.70.223
  68 +10.66.70.42
  69 +
  70 +
60 [java-union] 71 [java-union]
61 10.66.70.21 72 10.66.70.21
62 10.66.70.49 73 10.66.70.49
@@ -62,6 +62,11 @@ @@ -62,6 +62,11 @@
62 10.66.104.48 62 10.66.104.48
63 63
64 64
  65 +[java-uic]
  66 +10.66.104.7
  67 +10.66.104.39
  68 +
  69 +
65 [java-union] 70 [java-union]
66 10.66.70.21 71 10.66.70.21
67 10.66.70.49 72 10.66.70.49
  1 +# inventory file for az2
  2 +
  3 +[nameservers]
  4 +10.66.105.5
  5 +10.66.105.9
  6 +
1 [java-nginx] 7 [java-nginx]
2 10.66.104.15 8 10.66.104.15
3 10.66.104.13 9 10.66.104.13
@@ -56,6 +62,11 @@ @@ -56,6 +62,11 @@
56 10.66.104.48 62 10.66.104.48
57 63
58 64
  65 +[java-uic]
  66 +10.66.104.7
  67 +10.66.104.39
  68 +
  69 +
59 [java-union] 70 [java-union]
60 10.66.70.21 71 10.66.70.21
61 10.66.70.49 72 10.66.70.49
@@ -60,6 +60,11 @@ @@ -60,6 +60,11 @@
60 10.66.202.39 60 10.66.202.39
61 61
62 62
  63 +[java-uic]
  64 +10.66.202.7
  65 +10.66.202.32
  66 +
  67 +
63 [java-union] 68 [java-union]
64 10.66.70.21 69 10.66.70.21
65 10.66.70.49 70 10.66.70.49
  1 +# inventory file for az2
  2 +
  3 +[nameservers]
  4 +10.66.200.10
  5 +10.66.200.12
  6 +
1 [java-nginx] 7 [java-nginx]
2 10.66.202.5 8 10.66.202.5
3 10.66.202.12 9 10.66.202.12
@@ -54,6 +60,11 @@ @@ -54,6 +60,11 @@
54 10.66.202.39 60 10.66.202.39
55 61
56 62
  63 +[java-uic]
  64 +10.66.202.7
  65 +10.66.202.32
  66 +
  67 +
57 [java-union] 68 [java-union]
58 10.66.70.21 69 10.66.70.21
59 10.66.70.49 70 10.66.70.49
@@ -25,7 +25,7 @@ call("git clone --recursive git@git.yoho.cn:yohoops/auto_deploy.git %s" % PATH @@ -25,7 +25,7 @@ call("git clone --recursive git@git.yoho.cn:yohoops/auto_deploy.git %s" % PATH
25 25
26 # get iptables info from git files. 26 # get iptables info from git files.
27 azs_mappings = {"qcloud": "az1", "qcloudaz2": "az2", "qcloudaz3": "az3"} 27 azs_mappings = {"qcloud": "az1", "qcloudaz2": "az2", "qcloudaz3": "az3"}
28 -host_group = { "yoho_gateway": "java-gateway", 28 +host_group = {"yoho_gateway": "java-gateway",
29 "yoho_users": "java-users", 29 "yoho_users": "java-users",
30 "yohobuy_resources": "java-resources", 30 "yohobuy_resources": "java-resources",
31 "yohobuy_order" : "java-order", 31 "yohobuy_order" : "java-order",
@@ -47,15 +47,16 @@ for _az in azs_mappings.keys(): @@ -47,15 +47,16 @@ for _az in azs_mappings.keys():
47 all_groups[azs_mappings[_az]] = groups 47 all_groups[azs_mappings[_az]] = groups
48 file = open(os.path.join(PATH, "scripts/iptable/", _az, "app-iptable.sh"), 'r') 48 file = open(os.path.join(PATH, "scripts/iptable/", _az, "app-iptable.sh"), 'r')
49 for line in file: 49 for line in file:
50 - for group_name in host_group.keys():  
51 - if group_name in line: 50 + for deploy_prj_name in host_group.keys():
  51 + if line.strip().startswith(deploy_prj_name):
52 g_hosts = [] 52 g_hosts = []
53 - groups[host_group[group_name]] = g_hosts 53 + groups[host_group[deploy_prj_name]] = g_hosts
54 i_1 = line.index("(") 54 i_1 = line.index("(")
55 i_2 = line.index(")") 55 i_2 = line.index(")")
56 sub = line[i_1 + 1 : i_2] 56 sub = line[i_1 + 1 : i_2]
57 - for user_ip in sub.split(" "):  
58 - g_hosts.append(user_ip[user_ip.index("@") + 1 : ].strip()) 57 + for user_ip in sub.split("master@"):
  58 + if user_ip.strip() != '':
  59 + g_hosts.append(user_ip.strip())
59 60
60 61
61 file.close() 62 file.close()