2020-11-02 04:51:35 +01:00
|
|
|
---
|
|
|
|
- name: Create default site plain http configuration
|
2021-02-04 16:01:30 +01:00
|
|
|
become: true
|
|
|
|
ansible.builtin.template:
|
2021-02-27 00:46:37 +01:00
|
|
|
src: '{{ item }}'
|
2020-11-02 04:51:35 +01:00
|
|
|
dest: '/etc/nginx/sites-available/{{ inventory_hostname }}_http'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 'u=rw,g=r,o=r'
|
2021-02-27 00:46:37 +01:00
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- 'files/nginx/sites/default_http.conf'
|
|
|
|
- 'files/nginx/sites-available/default_http.conf.j2'
|
2020-11-02 04:51:35 +01:00
|
|
|
notify:
|
2021-02-04 13:49:56 +01:00
|
|
|
- systemctl reload nginx
|
2020-11-02 04:51:35 +01:00
|
|
|
|
|
|
|
- name: Create default site tls https configuration
|
2021-02-04 16:01:30 +01:00
|
|
|
become: true
|
2021-02-06 16:23:23 +01:00
|
|
|
ansible.builtin.template:
|
2021-02-27 00:46:37 +01:00
|
|
|
template:
|
|
|
|
src: '{{ item }}'
|
2020-11-02 04:51:35 +01:00
|
|
|
dest: '/etc/nginx/sites-available/{{ inventory_hostname }}_tls'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 'u=rw,g=r,o=r'
|
2021-02-27 00:46:37 +01:00
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- 'files/nginx/sites/default_tls.conf'
|
|
|
|
- 'files/nginx/sites-available/default_tls.conf.j2'
|
2020-11-02 04:51:35 +01:00
|
|
|
notify:
|
2021-02-04 13:49:56 +01:00
|
|
|
- systemctl reload nginx
|
2020-11-02 04:51:35 +01:00
|
|
|
|
|
|
|
- name: Enable default site plain http configuration
|
2021-02-04 16:01:30 +01:00
|
|
|
become: true
|
2021-02-06 16:23:23 +01:00
|
|
|
ansible.builtin.file:
|
2020-11-02 04:51:35 +01:00
|
|
|
src: '/etc/nginx/sites-available/{{ inventory_hostname }}_http'
|
|
|
|
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_http'
|
|
|
|
state: link
|
|
|
|
notify:
|
2021-02-04 13:49:56 +01:00
|
|
|
- systemctl reload nginx
|
2020-11-02 04:51:35 +01:00
|
|
|
|
|
|
|
# Note: Done by acmetool after sucessfully obtaining a suitable certificate
|
2021-02-04 16:01:30 +01:00
|
|
|
- name: Enable default site configuration
|
|
|
|
become: true
|
2021-02-06 16:23:23 +01:00
|
|
|
ansible.builtin.file:
|
2021-02-04 16:01:30 +01:00
|
|
|
src: '/etc/nginx/sites-available/{{ inventory_hostname }}_tls'
|
|
|
|
dest: '/etc/nginx/sites-enabled/{{ inventory_hostname }}_tls'
|
|
|
|
state: link
|
|
|
|
notify:
|
|
|
|
- systemctl reload nginx
|
2021-02-27 00:46:37 +01:00
|
|
|
when: nginx__disable_acmetool
|
|
|
|
tags:
|
|
|
|
- configuration
|
|
|
|
- nginx
|
|
|
|
- sites
|