From 19ecb0bca1d70e036f51fa7c12af34dbf279e9e8 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Tue, 20 Dec 2022 00:14:15 +0100 Subject: [PATCH] add destroy files --- roles/deploy-web/tasks/destroy.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/roles/deploy-web/tasks/destroy.yml b/roles/deploy-web/tasks/destroy.yml index 9919252..f5334ed 100644 --- a/roles/deploy-web/tasks/destroy.yml +++ b/roles/deploy-web/tasks/destroy.yml @@ -15,6 +15,42 @@ path: "/var/www/{{ project_name }}" state: absent when: "project_name is defined" + vars: + ansible_become: yes + ansible_become_method: sudo + ansible_become_password: "{{ sudo_password }}" + +- name: "Delete symlink" + file: + path: "/etc/nginx/sites-enabled/{{ item.conf_name }}" + state: absent + when: "item.conf_name is defined" + with_items: + - "{{ project }}" + vars: + ansible_become: yes + ansible_become_method: sudo + ansible_become_password: "{{ sudo_password }}" + +- name: "remove configure nginx" + file: + path: "/etc/nginx/sites-available/{{ item.conf_name }}" + state: absent + when: "item.conf_name is defined" + with_items: + - "{{ project }}" + vars: + ansible_become: yes + ansible_become_method: sudo + ansible_become_password: "{{ sudo_password }}" + + + + +- name: restart nginx + service: + name: nginx + state: restarted vars: ansible_become: yes ansible_become_method: sudo