73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
---
|
|
- name: Install NGINX
|
|
apt:
|
|
update_cache: true
|
|
name: nginx
|
|
register: apt_result
|
|
retries: 3
|
|
until: apt_result is succeeded
|
|
|
|
- name: Copy snippets
|
|
template:
|
|
src: "nginx/snippets/{{ item }}.j2"
|
|
dest: "/etc/nginx/snippets/{{ item }}"
|
|
mode: 0644
|
|
loop:
|
|
- options-ssl.conf
|
|
- options-proxypass.conf
|
|
|
|
- name: Copy dhparam
|
|
template:
|
|
src: letsencrypt/dhparam.j2
|
|
dest: /etc/letsencrypt/dhparam
|
|
mode: 0644
|
|
|
|
- name: Copy reverse proxy sites
|
|
template:
|
|
src: "nginx/sites-available/{{ item }}.j2"
|
|
dest: "/etc/nginx/sites-available/{{ item }}"
|
|
mode: 0644
|
|
loop:
|
|
- reverseproxy
|
|
- reverseproxy_redirect_dname
|
|
- redirect
|
|
notify: Reload nginx
|
|
|
|
- name: Activate sites
|
|
file:
|
|
src: "/etc/nginx/sites-available/{{ item }}"
|
|
dest: "/etc/nginx/sites-enabled/{{ item }}"
|
|
state: link
|
|
mode: 0644
|
|
loop:
|
|
- reverseproxy
|
|
- reverseproxy_redirect_dname
|
|
- redirect
|
|
notify: Reload nginx
|
|
|
|
- name: Copy forward modules
|
|
template:
|
|
src: "nginx/modules-available/60-forward.conf.j2"
|
|
dest: "/etc/nginx/modules-available/60-forward.conf"
|
|
mode: 0644
|
|
notify: Reload nginx
|
|
|
|
- name: Activate modules
|
|
file:
|
|
src: "/etc/nginx/modules-available/60-forward.conf"
|
|
dest: "/etc/nginx/modules-enabled/60-forward.conf"
|
|
state: link
|
|
mode: 0644
|
|
notify: Reload nginx
|
|
|
|
- name: Copy 50x error page
|
|
template:
|
|
src: www/html/50x.html.j2
|
|
dest: /var/www/html/50x.html
|
|
mode: 0644
|
|
|
|
- name: Indicate role in motd
|
|
template:
|
|
src: update-motd.d/05-service.j2
|
|
dest: /etc/update-motd.d/05-nginx
|
|
mode: 0755
|