infrastructure/ansible/roles/nginx/tasks/main.yml
Jake Howard 2336e4dd5b
All checks were successful
/ terraform (push) Successful in 1m5s
/ ansible (push) Successful in 2m19s
Add brotli
2023-12-17 18:12:33 +00:00

64 lines
1.4 KiB
YAML

- name: Install nginx
import_role:
name: nginxinc.nginx
when: ansible_os_family != 'Archlinux'
become: true
- name: Install nginx (mainline) on Arch
package:
name: nginx-mainline
when: ansible_os_family == 'Archlinux'
become: true
- name: Install nginx-mod-http-headers-more
package:
name: libnginx-mod-http-headers-more-filter
when: ansible_os_family != 'Archlinux'
become: true
- name: Install nginx-mod-http-headers-more on Arch
kewlfft.aur.aur:
name: nginx-mainline-mod-headers-more
when: ansible_os_family == 'Archlinux'
become: true
- name: Install nginx-mod-brotli
package:
name: libnginx-mod-http-brotli-filter
when: ansible_os_family != 'Archlinux'
become: true
- name: Install nginx-mod-brotli on Arch
kewlfft.aur.aur:
name: nginx-mainline-mod-brotli
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
when: nginx_https_redirect