blob: 37d2793576b628dff3908a8cd99bdb33ead418f6 (
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
|
---
- name: Install NGINX & modules
package:
name:
- nginx
- libnginx-mod-http-lua
- libnginx-mod-http-geoip
state: present
tags:
- role::nginx
- name: Copy NGINX default config
template:
src: default_server.conf
dest: /etc/nginx/conf.d/default_server.conf
group: root
owner: root
mode: "0644"
tags:
- role::nginx
notify:
- Reload the nginx service
- name: Remove default nginx site
file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Copy host-specific configs
copy:
content: |
# Ansible managed
{{ item.value }}
dest: "/etc/nginx/sites-available/{{ item.key }}"
mode: "0644"
group: root
owner: root
with_items:
- "{{ nginx_configs | dict2items }}"
tags:
- role::nginx
when: nginx_configs is defined
notify:
- Reload the nginx service
- name: Enable host-specific sites
file:
src: "/etc/nginx/sites-available/{{ item }}"
dest: "/etc/nginx/sites-enabled/{{ item }}"
state: link
with_items:
- "{{ nginx_configs.keys() }}"
tags:
- role::nginx
when: nginx_configs is defined
notify:
- Reload the nginx service
|