-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathclusterDownGradeVersion.yml
47 lines (42 loc) · 1.38 KB
/
clusterDownGradeVersion.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- hosts: clusterNodes:clusterAddNodes
gather_facts: false
any_errors_fatal: true
become: true
tasks:
- name: check kafka-{{ kafkaOldVersion }} installation files
ansible.builtin.stat:
path: "{{ kafkaInstallDir }}/kafka_{{ kafkaOldScalaVersion }}-{{ kafkaOldVersion }}"
register: kafkaOldVersionStatus
- name: fails if kafka installation files are missing
ansible.builtin.fail:
msg: "kafka down grade is not possible as kafka old installation files are missing"
when: not kafkaOldVersionStatus.exists
- hosts: clusterNodes:clusterAddNodes
gather_facts: false
serial: 1
tasks:
- name: reverting kafka version to {{ kafkaOldVersion }}-{{ kafkaOldScalaVersion }}
ansible.builtin.import_role:
name: install
tasks_from: createSymlink
vars:
kafkaVersion: "{{ kafkaOldVersion }}"
kafkaScalaVersion: "{{ kafkaOldScalaVersion }}"
- name: restarting all nodes
ansible.builtin.import_role:
name: serviceState
vars:
serviceName: kafka
serviceState: restarted
when: kafkaSymlinkStatus.changed
- name: kafka Port Status
ansible.builtin.include_role:
name: portCheck
vars:
portNumber: "{{ item }}"
portStatus: started
loop:
- "{{ kafkaPort }}"
- "{{ kafkaJmxPort }}"
when: kafkaSymlinkStatus.changed