This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-deployment-ansible-d…/Clickhouse/21.8.13.1/clickhouse/role/tasks/standalone/uninstall.yml
2024-01-18 15:35:34 +08:00

51 lines
1.5 KiB
YAML

- block:
- name: Stopping and removing {{ container_name }} container
docker_container:
name: '{{ container_name }}'
state: absent
- name: Removing old {{ image_name }} image
docker_image:
name: '{{ image_name }}'
tag: '{{ image_tag }}'
state: absent
- name: Stopping and removing exporter container
docker_container:
name: 'clickhouse_exporter'
state: absent
- name: Removing old exporter image
docker_image:
name: 'clickhouse_exporter'
tag: 'v2.0'
state: absent
- name: Ansible delete old {{ deploy_dir }}/{{ container_name }}
file:
path: '{{ deploy_dir }}/{{ container_name }}'
state: absent
- name: Checking ZooKeeper has Clickhouse nodes
shell: "docker exec zookeeper zkCli.sh ls / | grep clickhouse | wc -l"
run_once: true
delegate_to: "{{ groups.zookeeper[0] }}"
register: has_zknode
- name: Delete Clickhouse nodes in ZooKeeper
shell: "docker exec zookeeper zkCli.sh rmr /clickhouse"
run_once: true
delegate_to: "{{ groups.zookeeper[0] }}"
when: has_zknode.stdout >= '1'
- name: Checking if the Clickhouse service already exists
shell: rpm -qa | grep clickhouse | wc -l
register: check_out
- name: To terminate execution
fail:
msg: "Uninstalling ClickHouse fails.Please uninstall manually with yum remove"
run_once: true
delegate_to: 127.0.0.1
when: check_out.stdout >= '1'