Browse Source

Add uninstall

devuan/0.14.0
Beer 1 year ago
parent
commit
0044b92cc6
No known key found for this signature in database GPG Key ID: E7D86E358DC831A4
2 changed files with 34 additions and 0 deletions
  1. +17
    -0
      README.md
  2. +17
    -0
      tasks/main.yml

+ 17
- 0
README.md View File

@@ -217,6 +217,23 @@ This is a sample playbook file for deploying the Ansible Galaxy NGINX role in a

To run any of the above sample playbooks create a `setup-nginx.yml` file and paste the contents. Executing the Ansible Playbook is then as simple as executing `ansible-playbook setup-nginx.yml`.

Uninstallation
--------------

To uninstall, either:
- Change the value of the `nginx_enable` variable to `false` in the used playbook (hereafter `setup-nginx.yml`), passed on to the `ansible-role-nginx` role, or use the following:
```
---
- hosts: localhost
become: true
roles:
- role: ansible-role-nginx
vars:
nginx_enable: false
```
- Pass `--extra-vars "nginx_enable=false"` to `ansible-playbook`, such as in `ansible-playbook --extra-vars="nginx_enable=false" setup-nginx.yml`

Cf. ["Variable precedence" in Ansible documentation](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable)

License
-------


+ 17
- 0
tasks/main.yml View File

@@ -35,3 +35,20 @@
tags: nginx_debug_output

when: nginx_enable | bool

- name: "Uninstall nginx"
block:

- name: "Purge nginx"
apt:
name: nginx
state: absent
purge: yes
autoremove: yes
autoclean: yes

- import_tasks: conf/cleanup-config.yml
tags: nginx_cleanup_config

when: not nginx_enable | bool
tags: nginx_purge

Loading…
Cancel
Save