2019-02-05 08:35:45 +01:00
|
|
|
---
|
|
|
|
# nginx is the proxy server
|
|
|
|
- name: Install NGINX server
|
|
|
|
apt:
|
|
|
|
name: nginx
|
2019-03-03 09:00:29 +01:00
|
|
|
update_cache: true
|
2019-02-05 08:35:45 +01:00
|
|
|
|
|
|
|
# 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
|
2019-03-04 09:34:47 +01:00
|
|
|
|
|
|
|
# Install main site
|
|
|
|
- name: Configure NGINX main site
|
|
|
|
template:
|
|
|
|
src: nginx-sites-available-main.j2
|
|
|
|
dest: /etc/nginx/sites-available/main
|
|
|
|
mode: 0644
|
|
|
|
notify: Reload NGINX service
|
|
|
|
|
|
|
|
# Activate main site
|
|
|
|
- name: Activate main site
|
|
|
|
file:
|
|
|
|
src: /etc/nginx/sites-available/main
|
|
|
|
dest: /etc/nginx/sites-enabled/main
|
|
|
|
state: link
|
|
|
|
notify: Reload NGINX service
|