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

25 lines
754 B
YAML

---
- name: Find matching nginx configs for {{ domain }}
ansible.builtin.find:
paths: "{{ NGINX.DIRECTORIES.HTTP.SERVERS }}"
patterns: "*.{{ domain }}.conf"
register: find_result
- name: "Reinitialize OpenResty Handler"
include_tasks: utils/load_handlers.yml
vars:
handler_role_name: "svc-prx-openresty"
- 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