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…/Apache Kafka/3.4.1/kafka/role/tasks/uninstall.yml

40 lines
1.1 KiB
YAML
Raw Normal View History

- 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: 'kafka_exporter'
state: absent
- name: Removing old exporter image
docker_image:
name: 'kafka_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 Kafka nodes
shell: "docker exec -it zookeeper zkCli.sh ls / | grep kafka | wc -l"
run_once: true
delegate_to: "{{ groups.zookeeper[0] }}"
register: has_zknode
- name: Delete Kafka nodes in ZooKeeper
shell: "docker exec -it zookeeper zkCli.sh rmr /kafka"
run_once: true
delegate_to: "{{ groups.zookeeper[0] }}"
when: has_zknode.stdout >= '1'