2020-12-24 14:27:31 +01:00
|
|
|
---
|
|
|
|
- name: install nginx
|
|
|
|
pacman: name=nginx state=present
|
|
|
|
notify: restart nginx
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_nginx is not defined
|
2020-12-24 14:27:31 +01:00
|
|
|
|
2024-01-03 15:46:28 +01:00
|
|
|
- name: install nginx-mod-headers-more for matomo
|
|
|
|
pacman:
|
|
|
|
name: nginx-mod-headers-more
|
|
|
|
state: present
|
|
|
|
notify: restart nginx
|
|
|
|
when: run_once_nginx is not defined and nginx_matomo_tracking | bool
|
|
|
|
|
2023-12-12 12:32:35 +01:00
|
|
|
- name: Ensure nginx configuration directories are present
|
2020-12-24 14:27:31 +01:00
|
|
|
file:
|
2023-12-12 12:32:35 +01:00
|
|
|
path: "{{ item }}"
|
2020-12-24 14:27:31 +01:00
|
|
|
state: directory
|
2023-12-12 12:32:35 +01:00
|
|
|
mode: '0755'
|
|
|
|
loop:
|
|
|
|
- "{{nginx_servers_directory}}"
|
|
|
|
- "{{nginx_maps_directory}}"
|
|
|
|
- "{{nginx_upstreams_directory}}"
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_nginx is not defined
|
2020-12-24 14:27:31 +01:00
|
|
|
|
|
|
|
- name: create nginx config file
|
2024-01-19 11:52:08 +01:00
|
|
|
template:
|
|
|
|
src: nginx.conf.j2
|
|
|
|
dest: /etc/nginx/nginx.conf
|
|
|
|
notify: restart nginx
|
|
|
|
when: run_once_nginx is not defined
|
|
|
|
|
|
|
|
- name: "include task certbot-matomo.yml"
|
|
|
|
include_tasks: certbot-matomo.yml
|
|
|
|
when: run_once_nginx is not defined
|
|
|
|
vars:
|
|
|
|
domain: "{{top_domain}}"
|
|
|
|
when: run_once_nginx is not defined
|
|
|
|
|
|
|
|
- name: configure {{top_domain}}.conf
|
|
|
|
template:
|
|
|
|
src: "homepage.nginx.conf.j2"
|
|
|
|
dest: "{{nginx_servers_directory}}{{top_domain}}.conf"
|
|
|
|
vars:
|
|
|
|
domain: "{{top_domain}}"
|
2020-12-24 14:27:31 +01:00
|
|
|
notify: restart nginx
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_nginx is not defined
|
2020-12-24 14:27:31 +01:00
|
|
|
|
|
|
|
- name: flush nginx service
|
|
|
|
meta: flush_handlers
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_nginx is not defined
|
|
|
|
|
|
|
|
- name: run the nginx tasks once
|
|
|
|
set_fact:
|
|
|
|
run_once_nginx: true
|
|
|
|
when: run_once_nginx is not defined
|