2022-11-12 20:45:00 +01:00
|
|
|
- name: "Remove all directories"
|
|
|
|
file:
|
2022-12-19 23:50:57 +01:00
|
|
|
path: "/var/www/{{ item.git_name }}"
|
2022-11-12 20:45:00 +01:00
|
|
|
state: absent
|
2022-12-19 23:50:57 +01:00
|
|
|
when: "item.git_name is defined and project_name is not defined"
|
2022-11-12 20:45:00 +01:00
|
|
|
with_items:
|
2022-12-19 23:46:55 +01:00
|
|
|
- "{{ project }}"
|
2022-11-12 20:45:00 +01:00
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_become_method: sudo
|
|
|
|
ansible_become_password: "{{ sudo_password }}"
|
|
|
|
|
|
|
|
- name: "Remove single directory"
|
|
|
|
file:
|
2022-12-19 23:46:55 +01:00
|
|
|
path: "/var/www/{{ project_name }}"
|
2022-11-12 20:45:00 +01:00
|
|
|
state: absent
|
2022-12-19 23:46:55 +01:00
|
|
|
when: "project_name is defined"
|
2022-12-20 00:14:15 +01:00
|
|
|
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
|
2022-11-12 20:45:00 +01:00
|
|
|
vars:
|
|
|
|
ansible_become: yes
|
|
|
|
ansible_become_method: sudo
|
|
|
|
ansible_become_password: "{{ sudo_password }}"
|