web-nginx.yml
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- hosts: web-nginx
remote_user: root
vars_prompt:
- name: "confirmation"
prompt: "Sync and reload java nginx. Please Enter [YES] to continue"
private: no
vars:
- path: /usr/local/openresty
tasks:
# make sure path exist
- name: "make sure path exist"
shell: ls /usr/local/openresty
ignore_errors: True
register: result
- name: "make sure openresty path exist"
fail:
msg: " openresty {{ path }} not exist!"
when: result is failed
# make sure group exists
- name: make sure groups exist in inventory file
fail:
msg: "group {{ item }} not exist!"
when: item not in groups
with_items:
- web-nginx
- name: copy yohobuywap-node statics files to openresty
copy:
src: 'templates/web-nginx/node/yohobuywap-node/current/yohobuywap-node/public/static/'
dest: "/Data/node/yohobuywap-node/current/yohobuywap-node/public/static/"
- name: copy PE files to openresty
copy:
src: templates/web-nginx/PE/
dest: "/Data/PE/"
- name: copy vhosts conf files to openresty
copy:
src: 'templates/web-nginx/vhosts/{{ item }}'
dest: "{{ path }}/nginx/conf/vhosts/"
with_items:
- location
- pc
- wap
- name: copy vhosts conf files to openresty
template:
src: web-nginx/vhosts/{{ item }}
dest: "{{ path }}/nginx/conf/vhosts/"
with_items:
- activity.yohocn.conf
- action.yohocn.conf
- shopmanage.yohobuy.com.conf
- xianyu.yohobuy.com.conf
- yohobuypc.conf
- yohobuywap.conf
- yohoglobalbs.conf
- badjs.yoho.cn.conf
- ali-report.yohobuy.com.conf
- cprice.yohobuy.com.conf
- nwtm.yohobuy.com.conf
- yohoblk.com.conf
- name: update nginx upstream for nginx.conf
template:
src: web-nginx/nginx.conf
dest: "{{ path }}/nginx/conf/nginx.conf"
- name: reload nginx
command: "{{ path }}/nginx/sbin/nginx -s reload"