blob: 7aab3e9c669f092f1394a8f5ff592d6d65c7de00 (
plain) (
blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
---
- name: Include install tasks
include_tasks: install.yml
- name: Include enable tasks
include_tasks: enable.yml
- name: Include Alpine specific tasks
include_tasks: alpine.yml
when: ansible_facts['distribution'].lower() == "alpine"
- name: Lock down and setup configuration directories
file:
path: '{{item}}'
state: directory
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "{{nginx_conf_dir_mode}}"
loop:
- "{{nginx_conf_dir}}"
- "{{nginx_conf_dir}}/conf.d"
tags:
- nginx-conf
- conf
- name: Create Robots directory
file:
path: /var/lib/nginx-robots
state: directory
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "0755"
tags:
- robots
- nginx-conf
- conf
- name: Create Robots sub directory
file:
path: '/var/lib/nginx-robots/{{item.name}}'
state: directory
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "0755"
loop: '{{nginx_robots}}'
tags:
- robots
- nginx-conf
- conf
- name: 'Install {{item.name}} robots'
copy:
dest: '/var/lib/nginx-robots/{{item.name}}/robots.txt'
content: '{{item.robots_txt}}'
owner: '{{nginx_conf_owner}}'
loop: '{{nginx_robots}}'
tags:
- robots
- nginx-conf
- conf
- name: Install Robots includes
copy:
dest: "{{nginx_conf_dir}}/robots_{{item.name}}"
content: |
location /robots.txt {
root /var/lib/nginx-robots/{{item.name}};
}
owner: '{{nginx_conf_owner}}'
loop: '{{nginx_robots}}'
tags:
- robots
- nginx-conf
- conf
- name: Install 'nginx.conf'
copy:
content: '{{nginx_conf}}'
dest: "{{nginx_conf_dir}}/nginx.conf"
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "{{nginx_conf_file_mode}}"
notify:
- Restart Nginx
tags:
- nginx-conf
- conf
- name: Install Nginx Snippets
copy:
content: '{{item.value}}'
dest: "{{nginx_conf_dir}}/{{item.key}}"
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "{{nginx_conf_file_mode}}"
loop: '{{nginx_includes | dict2items}}'
when: 'nginx_includes is defined'
notify: Restart Nginx
tags:
- nginx-conf
- conf
- name: Install Nginx conf.d entires
copy:
content: '{{item.value}}'
dest: "{{nginx_conf_dir}}/conf.d/{{item.key}}"
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
mode: "{{nginx_conf_file_mode}}"
loop: '{{nginx_confd | dict2items}}'
when: 'nginx_confd is defined'
notify: Restart Nginx
tags:
- nginx-conf
- conf
- name: Install Htpasswd
copy:
src: '{{nginx_htpasswd}}'
dest: /etc/htpasswd
owner: "{{nginx_conf_owner}}"
group: "{{nginx_conf_group}}"
when: nginx_htpasswd is defined
tags:
- nginx-conf
- conf
- htpasswd
|