提交各组件部署Ansible剧本初版

This commit is contained in:
qidaijie
2024-01-18 15:35:33 +08:00
parent f0bd05d565
commit 0cc392df5c
262 changed files with 15927 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
- 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'