From 94b9ca736f172fdc5790711442ddaab98cba7ec2 Mon Sep 17 00:00:00 2001 From: Romain Pelisse Date: Fri, 8 Dec 2023 14:56:47 +0100 Subject: [PATCH] plays: add flush_handlers to ensure service is running before post_tasks --- playbooks/playbook.yml | 15 ++++++++++++++- playbooks/validate.yml | 8 +------- roles/amq_streams_cruise_control/tasks/main.yml | 3 --- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/playbooks/playbook.yml b/playbooks/playbook.yml index b37cde1..2d1f8de 100644 --- a/playbooks/playbook.yml +++ b/playbooks/playbook.yml @@ -19,6 +19,19 @@ vars: amq_streams_common_skip_download: true + - name: "Ensure Kafka Connect is running and available." + ansible.builtin.include_role: + name: amq_streams_connect + vars: + connectors: + - { name: "file", path: "connectors/file.yml" } + - name: "Give a rest to the target, sometimes broker takes a while to start" + ansible.builtin.wait_for: + timeout: 60 + + - name: "Flush all handlers to be sure services are ready for post_tasks." + ansible.builtin.meta: flush_handlers + post_tasks: - name: "Ensures topics exist." ansible.builtin.include_role: name: amq_streams_broker @@ -57,7 +70,7 @@ vars: connectors: - { name: "file", path: "connectors/file.yml" } - post_tasks: + - name: "Display numbers of Zookeeper instances managed by Ansible." ansible.builtin.debug: msg: "Numbers of Zookeeper instances: {{ amq_streams_zookeeper_instance_count }}." diff --git a/playbooks/validate.yml b/playbooks/validate.yml index b2a3fd3..e80e246 100644 --- a/playbooks/validate.yml +++ b/playbooks/validate.yml @@ -6,26 +6,20 @@ ansible.builtin.include_role: name: "amq_streams_zookeeper" tasks_from: validate.yml - when: - - amq_streams_zookeeper_enabled is defined and amq_streams_zookeeper_enabled - name: "Validate Broker installation on target" ansible.builtin.include_role: name: "amq_streams_broker" tasks_from: validate.yml - when: - - amq_streams_broker_enabled - name: "Validate Kafka Connect installation on target" ansible.builtin.include_role: name: "amq_streams_connect" tasks_from: validate.yml - when: - - amq_streams_connect_enabled - name: "Validate Cruise Control installation on target" ansible.builtin.include_role: name: "amq_streams_cruise_control" tasks_from: validate.yml when: - - amq_streams_connect_enabled + - amq_streams_cruise_control_enabled is defined and amq_streams_cruise_control_enabled diff --git a/roles/amq_streams_cruise_control/tasks/main.yml b/roles/amq_streams_cruise_control/tasks/main.yml index 39ea626..851d1a1 100644 --- a/roles/amq_streams_cruise_control/tasks/main.yml +++ b/roles/amq_streams_cruise_control/tasks/main.yml @@ -60,9 +60,6 @@ - amq_streams_firewalld_enabled is defined and amq_streams_firewalld_enabled - amq_streams_cruise_control_port is defined - - - - name: "Deploy Cruise Control as a systemd service." ansible.builtin.include_role: name: amq_streams_common