Files
computer-playbook/roles/sys-svc-cln-domains/tasks/remove_deprecated_nginx_configs.yml

20 lines
620 B
YAML

---
- name: Find matching nginx configs for {{ domain }}
ansible.builtin.find:
paths: "{{ NGINX.DIRECTORIES.HTTP.SERVERS }}"
patterns: "*.{{ domain }}.conf"
register: find_result
- name: Remove wildcard nginx configs for {{ domain }}
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ find_result.files | default([]) }}"
when: item is defined
notify: restart openresty
- name: Remove exact nginx config for {{ domain }}
ansible.builtin.file:
path: "{{ [ NGINX.DIRECTORIES.HTTP.SERVERS, domain ~ '.conf'] | path_join }}"
state: absent
notify: restart openresty