ansible/roles/nginx-reverse-proxy/tasks/main.yml
Hadrien Patte b55a2ee047
Fix: add a retry statement to remote package tasks
Signed-off-by: Hadrien Patte <hadrien.patte@protonmail.com>
2019-03-03 19:55:51 +01:00

34 lines
826 B
YAML

---
# nginx is the proxy server
- name: Install NGINX server
apt:
name: nginx
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
# Install sites
- name: Configure NGINX sites
template:
src: nginx-sites-available.j2
dest: /etc/nginx/sites-available/{{ item.name }}
mode: 0644
loop: "{{ reversed_proxy_subdomains }}"
notify: Reload NGINX service
# Desactive useless nginx sites
- name: Deactivate the default NGINX site
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: Reload NGINX service
# Activate sites
- name: Activate sites
file:
src: /etc/nginx/sites-available/{{ item.name }}
dest: /etc/nginx/sites-enabled/{{ item.name }}
state: link
loop: "{{ reversed_proxy_subdomains }}"
notify: Reload NGINX service