Skip to content
Snippets Groups Projects
Commit caedc2d4 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Deactivate unconfigured sites

parent 481a2218
Branches
No related tags found
No related merge requests found
......@@ -53,6 +53,23 @@
notify:
- restart nginx
- name: get activated sites
find:
paths: /etc/nginx/sites-enabled
pattern: '*.conf'
file_type: link
register: activated_sites
- name: deactivate unconfigured sites
file:
path: "/etc/nginx/sites-enabled/{{item}}.conf"
state: absent
loop: "{{activated_sites.files|map(attribute='path')|map('basename')|map('splitext')|map('first')|difference(webservers|selectattr('enabled')|map(attribute='name'))|list}}"
loop_control:
label: "{{item}}"
notify:
- restart nginx
- name: ensure we have our sites tls-proxied
template:
src: servers/public.conf
......@@ -96,3 +113,20 @@
label: "{{item.name}}"
notify:
- restart nginx-proxy
- name: get activated proxy sites
find:
paths: /etc/nginx/proxy-sites-enabled
pattern: '*.conf'
file_type: link
register: activated_proxy_sites
- name: deactivate unconfigured proxy sites
file:
path: "/etc/nginx/proxy-sites-enabled/{{item}}.conf"
state: absent
loop: "{{activated_proxy_sites.files|map(attribute='path')|map('basename')|map('splitext')|map('first')|difference(webservers|selectattr('enabled')|map(attribute='name'))|list}}"
loop_control:
label: "{{item}}"
notify:
- restart nginx-proxy
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment