blob: 19791235e91d726fd376ca9ba2111f860816c53d (
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
|
---
- name: install nginx
apt:
name: "{{ nginx_pkg_name }}"
state: present
- name: remove nginx default config
file:
name: /etc/nginx/sites-enabled/default
state: absent
notify: restart nginx
- name: install nginx config snippets
loop:
- ssl
- hsts
copy:
src: "{{ global_files_dir }}/common/nginx-snippets/{{ item }}.conf"
dest: /etc/nginx/snippets/
notify: restart nginx
- name: generate Diffie-Hellman parameters
openssl_dhparam:
path: /etc/ssl/dhparams.pem
size: 2048
notify: restart nginx
- name: install nginx configs from template
loop: "{{ nginx_vhosts | dict2items }}"
loop_control:
label: "{{ item.key }}"
when: "'template' in item.value"
template:
src: "{{ item.value.template }}.conf.j2"
dest: "/etc/nginx/sites-available/{{ item.key }}"
notify: restart nginx
- name: install nginx configs from config data
loop: "{{ nginx_vhosts | dict2items }}"
loop_control:
label: "{{ item.key }}"
when: "'contents' in item.value"
copy:
contents: "{{ item.value.contents }}"
dest: "/etc/nginx/sites-available/{{ item.key }}"
notify: restart nginx
- name: generate acme certificate
loop: "{{ nginx_vhosts | dict2items }}"
loop_control:
label: "{{ item.key }} ({{ item.value.hostnames | join(', ') }})"
when: item.value.acme
include_tasks: acme.yml
|