-
-
Notifications
You must be signed in to change notification settings - Fork 607
/
nginx.yml
44 lines (39 loc) · 1.4 KB
/
nginx.yml
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
---
- name: Copy SSL cert
copy:
src: "{{ item.value.ssl.cert }}"
dest: "{{ nginx_ssl_path }}/{{ item.value.ssl.cert | basename }}"
mode: 0640
with_dict: "{{ wordpress_sites }}"
when: ssl_enabled and item.value.ssl.cert is defined
notify: reload nginx
- name: Copy SSL key
copy:
src: "{{ item.value.ssl.key }}"
dest: "{{ nginx_ssl_path }}/{{ item.value.ssl.key | basename }}"
mode: 0600
with_dict: "{{ wordpress_sites }}"
when: ssl_enabled and item.value.ssl.key is defined
notify: reload nginx
- import_tasks: "{{ playbook_dir }}/roles/common/tasks/disable_challenge_sites.yml"
- name: Create Nginx conf for challenges location
template:
src: "{{ playbook_dir }}/roles/letsencrypt/templates/acme-challenge-location.conf.j2"
dest: "{{ nginx_path }}/acme-challenge-location.conf"
notify: reload nginx
- name: Create WordPress configuration for Nginx
template:
src: "{{ item.value.nginx_wordpress_site_conf | default(nginx_wordpress_site_conf) }}"
dest: "{{ nginx_path }}/sites-available/{{ item.key }}.conf"
with_dict: "{{ wordpress_sites }}"
notify: reload nginx
tags: nginx-includes
- name: Enable WordPress site
file:
src: "{{ nginx_path }}/sites-available/{{ item.key }}.conf"
dest: "{{ nginx_path }}/sites-enabled/{{ item.key }}.conf"
owner: root
group: root
state: link
with_dict: "{{ wordpress_sites }}"
notify: reload nginx