Authored by chunhua.zhang

修改nginx的nameserver地址,从inventory文件中获取

@@ -5,7 +5,4 @@ dc : "yoho-qcloud" @@ -5,7 +5,4 @@ dc : "yoho-qcloud"
5 5
6 path: "/Data/local/openresty-1.9.15.1" 6 path: "/Data/local/openresty-1.9.15.1"
7 7
8 -# nameserver config for nginx  
9 -nameservers: ''  
10 -  
11 confirmation: '' 8 confirmation: ''
@@ -18,12 +18,6 @@ @@ -18,12 +18,6 @@
18 when: stat_result.stat.exists == False 18 when: stat_result.stat.exists == False
19 19
20 20
21 -# make sure vaviable [nameserver] exist  
22 -- name: "make sure variable [nameservers] exists"  
23 - fail:  
24 - msg: "variable [nameservers] not exist "  
25 - when: nameservers == ''  
26 -  
27 21
28 # make sure group exists 22 # make sure group exists
29 - name: make sure groups exist in inventory file 23 - name: make sure groups exist in inventory file
@@ -31,6 +25,7 @@ @@ -31,6 +25,7 @@
31 msg: "group {{ item }} not exist!" 25 msg: "group {{ item }} not exist!"
32 when: item not in groups 26 when: item not in groups
33 with_items: 27 with_items:
  28 + - nameservers
34 - java-nginx 29 - java-nginx
35 - java-gateway 30 - java-gateway
36 - java-brower 31 - java-brower
@@ -30,7 +30,7 @@ http @@ -30,7 +30,7 @@ http
30 '$http_user_agent|$upstream_addr'; 30 '$http_user_agent|$upstream_addr';
31 31
32 # resolver: local dns servers 32 # resolver: local dns servers
33 - resolver {% for i in nameservers %} {{ i }} {% endfor %}; 33 + resolver {% for i in group['nameservers'] %} {{ i }} {% endfor %};
34 34
35 35
36 #General Options 36 #General Options