nginx/tasks/remove-vhost.yml

33 lines
747 B
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: "Remove symlink {{ item.name }}"
file:
state: absent
path: "/etc/nginx/sites-enabled/{{ item.name }}"
when:
- item.state == "absent"
loop: "{{ nginx_vhost }}"
tags:
- resign
- name: "Remove website conf {{ item.name }}"
file:
state: absent
path: "/etc/nginx/sites-available/{{ item.name }}"
when:
- item.state == "absent"
loop: "{{ nginx_vhost }}"
tags:
- resign
- name: "Revoke Let's Encrypt cert for {{ item.name }}"
shell: "certbot revoke --delete-after-revoke --cert-path /etc/letsencrypt/live/{{ item.server_name[0] }}/cert.pem"
when:
- item.ssl
- item.letsencrypt
- item.state == "absent"
loop: "{{ nginx_vhost }}"
ignore_errors: yes
tags:
- resign