infrastructure/ansible/roles/nginx/tasks/main.yml
Jake Howard d5a7a61171
All checks were successful
/ terraform (push) Successful in 38s
/ ansible (push) Successful in 1m30s
Remove unnecessary use of become from some roles
This should make execution much faster
2024-09-09 17:09:03 +01:00

57 lines
1.2 KiB
YAML

- name: Install nginx
package:
name: nginx
- name: Install nginx modules
package:
name: "{{ item }}"
loop:
- libnginx-mod-http-headers-more-filter
- libnginx-mod-http-brotli-filter
- libnginx-mod-stream
when: ansible_os_family != 'Archlinux'
- name: Install nginx modules (on Arch)
kewlfft.aur.aur:
name: "{{ item }}"
loop:
- nginx-mod-headers-more
- nginx-mod-brotli
when: ansible_os_family == 'Archlinux'
- name: Generate Diffie-Hellman parameters
community.crypto.openssl_dhparam:
path: /etc/nginx/dhparams.pem
- name: Create config directories
file:
path: /etc/nginx/{{ item }}
state: directory
mode: "0755"
loop:
- http.d
- stream.d
- includes
- name: Copy config files
template:
src: "{{ item }}"
dest: /etc/nginx/includes/{{ item | basename }}
mode: "0644"
with_fileglob: files/includes/*.conf
notify: reload nginx
- name: Install config
template:
src: files/nginx.conf
dest: /etc/nginx/nginx.conf
mode: "0644"
notify: reload nginx
- name: Install HTTPS redirect
template:
src: files/nginx-https-redirect.conf
dest: /etc/nginx/http.d/https-redirect.conf
mode: "0644"
notify: reload nginx
when: nginx_https_redirect