1 --- |
1 --- |
2 |
2 |
3 - name: apt install nginx |
3 - name: apt install nginx |
4 become: yes |
4 become: yes |
5 apt: name="nginx" |
5 apt: name="nginx" |
|
6 notify: restart nginx |
6 |
7 |
7 - name: disable default site |
8 - name: disable default site |
8 become: yes |
9 become: yes |
9 file: path="/etc/nginx/sites-enabled/default" state="absent" |
10 file: path="/etc/nginx/sites-enabled/default" state="absent" |
|
11 notify: reload nginx |
10 |
12 |
11 - name: install base config |
13 - name: install base config |
12 become: yes |
14 become: yes |
13 copy: src="nginx.conf" dest="/etc/nginx/nginx.conf" |
15 copy: src="nginx.conf" dest="/etc/nginx/nginx.conf" |
14 notify: restart nginx |
16 notify: reload nginx |
15 |
17 |
16 - name: make stream dirs |
18 - name: make stream dirs |
17 become: yes |
19 become: yes |
18 file: path="/etc/nginx/streams-{{item}}" state="directory" |
20 file: path="/etc/nginx/streams-{{item}}" state="directory" |
19 loop: ["available", "enabled"] |
21 loop: ["available", "enabled"] |
|
22 notify: reload nginx |
20 |
23 |
21 - name: make config available |
24 - name: make config available |
22 become: yes |
25 become: yes |
23 template: |
26 template: |
24 src: "{{nginx_conf_src}}" |
27 src: "{{nginx_conf_src}}" |
25 dest: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf" |
28 dest: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf" |
26 notify: restart nginx |
29 notify: reload nginx |
27 |
30 |
28 - name: enable config |
31 - name: enable config |
29 become: yes |
32 become: yes |
30 file: |
33 file: |
31 src: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf" |
34 src: "/etc/nginx/{{nginx_server_type}}s-available/{{nginx_server_name}}.conf" |
32 dest: "/etc/nginx/{{nginx_server_type}}s-enabled/{{nginx_server_name}}.conf" |
35 dest: "/etc/nginx/{{nginx_server_type}}s-enabled/{{nginx_server_name}}.conf" |
33 state: "link" |
36 state: "link" |
34 notify: restart nginx |
37 notify: reload nginx |
35 |
38 |
36 - name: copy root files |
39 - name: copy root files |
37 become: yes |
40 become: yes |
38 copy: src="{{nginx_root_src}}" dest="{{nginx_root_dest}}/" |
41 copy: src="{{nginx_root_src}}" dest="{{nginx_root_dest}}/" |
39 when: nginx_root |
42 when: nginx_root |
40 notify: restart nginx |
43 notify: reload nginx |
41 |
44 |
42 - name: enable nginx service |
45 - name: enable nginx service |
43 become: yes |
46 become: yes |
44 systemd: name="nginx" enabled="yes" state="started" |
47 systemd: name="nginx.service" enabled="yes" state="started" daemon_reload="yes" |