forked from confluentinc/cp-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade_kafka_rest.yml
61 lines (53 loc) · 1.83 KB
/
upgrade_kafka_rest.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
- name: Kafka Rest Upgrade
hosts: kafka_rest
environment: "{{ proxy_env }}"
serial: 1
tasks:
- import_role:
name: confluent.variables_handlers
- name: Get Package Facts
package_facts:
manager: auto
- set_fact:
confluent_server_enabled: true
when: ansible_facts.packages['confluent-server'] is defined
- set_fact:
confluent_server_enabled: false
when: ansible_facts.packages['confluent-kafka-2.12'] is defined
- name: Set Current Package Version
set_fact:
kafka_rest_current_version: "{{ ansible_facts.packages['confluent-kafka-rest'][0]['version'] }}"
- debug:
msg: "Current version: {{kafka_rest_current_version}} Upgrade to version: {{confluent_package_version}}"
- name: Upgrade Kafka Connect
include_tasks: tasks/upgrade_component.yml
vars:
service_name: "{{ kafka_rest_service_name }}"
packages: "{{ kafka_rest_packages }}"
backup_files:
- "{{ kafka_rest.config_file }}"
- "{{ kafka_rest.systemd_override }}"
restore_files:
- "{{ kafka_rest.config_file }}"
when:
- kafka_rest_current_version != confluent_full_package_version
- kafka_rest_current_version != confluent_package_version
- name: Wait for API to return 200 - HTTP
uri:
url: "http://localhost:{{kafka_rest_port}}/topics"
status_code: 200
register: result
until: result.status == 200
retries: 60
delay: 5
when: not kafka_rest_ssl_enabled|bool
- name: Wait for API to return 200 - HTTPS
uri:
url: "https://localhost:{{kafka_rest_port}}/topics"
status_code: 200
validate_certs: no
register: result
until: result.status == 200
retries: 60
delay: 5
when: kafka_rest_ssl_enabled|bool