54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
---
|
|
- name: Uninstalling OneLab (1.27.0)
|
|
hosts: localhost
|
|
vars_prompt:
|
|
- name: "userchoice"
|
|
prompt: "Do you want to uninstall OneLab and remove all the data? Type: yes/no"
|
|
private: no
|
|
|
|
# Call from ./installation/latest/app/playbooks/uninstall.yml
|
|
|
|
tasks:
|
|
|
|
- name: Aborting the uninstall process
|
|
fail:
|
|
msg: Aborting the uninstall process
|
|
when: userchoice != "yes"
|
|
|
|
# Stop OneLab if OneLab is running
|
|
- name: Checking if OneLab is running
|
|
shell: docker stack ls | grep 'onelab' | wc -l
|
|
become: true
|
|
register: stack_count
|
|
|
|
- include_tasks: ./tasks/stop-onelab.yml
|
|
when: stack_count.stdout != "0"
|
|
- include_tasks: ./tasks/stop-proxy.yml
|
|
when: stack_count.stdout != "0"
|
|
|
|
# Remove Docker volumes (onelab_pgdata, onelab_rabbitmq_data)
|
|
- name: Removing Docker data
|
|
shell: |
|
|
docker volume rm onelab_pgdata -f
|
|
docker volume rm onelab_rabbitmq_data -f
|
|
become: true
|
|
|
|
# Remove Docker images
|
|
- name: Checking current OneLab images
|
|
shell: >
|
|
docker image ls | egrep 'onelab-' | egrep -v '1.27.0' | awk '{ print $3}'
|
|
register: onelab_old_images
|
|
become: true
|
|
|
|
- name: Pruning OneLab old images
|
|
shell:
|
|
docker rmi {{ item }}
|
|
become: true
|
|
loop: "{{ onelab_old_images.stdout_lines }}"
|
|
|
|
# Remove Docker login credentials
|
|
- name: Removing Docker login credentials
|
|
shell: |
|
|
docker logout hub.andrewalliance.com
|
|
become: true
|