Unify nginx configuration

This creates a simple base configuration skeleton, that other configuration can be easily loaded into.
This commit is contained in:
Jake Howard
2023-12-16 17:47:04 +00:00
parent 943c141d59
commit 92052a3d0a
16 changed files with 160 additions and 216 deletions

View File

@ -0,0 +1,38 @@
- name: Install nginx
import_role:
name: nginxinc.nginx
when: ansible_os_family != 'Archlinux'
become: true
- name: Install nginx on Arch
package:
name: nginx
when: ansible_os_family == 'Archlinux'
become: true
- name: Create config directories
file:
path: /etc/nginx/{{ item }}
state: directory
mode: "0755"
loop:
- http.d
- stream.d
become: true
- name: Install config
template:
src: files/nginx.conf
dest: /etc/nginx/nginx.conf
validate: nginx -t -c %s
mode: "0644"
become: true
notify: reload nginx
- name: Install HTTPS redirect
template:
src: files/nginx-https-redirect.conf
dest: /etc/nginx/http.d/https-redirect.conf
mode: "0644"
become: true
notify: reload nginx