Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DONOTMERGE - DEBUG Github Actions #92

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions roles/amq_streams_broker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,22 @@
when:
- amq_streams_zookeeper_auth_enabled is defined and amq_streams_zookeeper_auth_enabled

- name: "Wait for Zookeeper to be available - if host and port are provided."
- name: "Check and delete this"
ansible.builtin.command: systemctl status amq_streams_zookeeper
register: res
failed_when: False
changed_when: False

- name: "Display zk server state"
ansible.builtin.debug:
var: res

- name: "Wait for Zookeeper to be available - if enabled ({{ amq_streams_broker_zookeeper_host }}:{{ amq_streams_broker_zookeeper_port }})."
ansible.builtin.wait_for:
timeout: 600
host: "{{ amq_streams_broker_zookeeper_host }}"
port: "{{ amq_streams_broker_zookeeper_port }}"
when:
- 0 > 1 # Disabled until find a way to test the Zookeeper cluster connection (including all the zknodes)
- amq_streams_broker_zookeeper_host is defined
- amq_streams_broker_zookeeper_port is defined
- amq_streams_broker_zookeeper_wait is defined and amq_streams_broker_zookeeper_wait
Expand Down
51 changes: 40 additions & 11 deletions roles/amq_streams_common/tasks/validation/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,43 @@
- name: Populate service facts
ansible.builtin.service_facts:

- name: Check if service is started
ansible.builtin.assert:
that:
- ansible_facts is defined
- ansible_facts.services is defined
- ansible_facts.services["{{ service_name }}.service"] is defined
- ansible_facts.services["{{ service_name }}.service"]['state'] is defined
- ansible_facts.services["{{ service_name }}.service"]['state'] == 'running'
- ansible_facts.services["{{ service_name }}.service"]['status'] == 'enabled'
quiet: true
fail_msg: "Service is not started."
- name: "Verify that service is started with rescue"
block:
- name: Check if service is started
ansible.builtin.assert:
that:
- ansible_facts is defined
- ansible_facts.services is defined
- ansible_facts.services["{{ service_name }}.service"] is defined
- ansible_facts.services["{{ service_name }}.service"]['state'] is defined
- ansible_facts.services["{{ service_name }}.service"]['state'] == 'running'
- ansible_facts.services["{{ service_name }}.service"]['status'] == 'enabled'
quiet: true
fail_msg: "Service is not started."
rescue:
- name: "Check service status"
ansible.builtin.command: systemctl status "{{ service_name }}.service"
register: systemctl_result
changed_when: False

- name: "Print result"
ansible.builtin.debug:
var: systemctl_result

- name: "Restart service"
ansible.builtin.service:
name: "{{ service_name }}.service"
state: restarted

- name: "Wait 30s"
ansible.builtin.wait_for:
timeout: 30

- name: "Check service status"
ansible.builtin.command: systemctl status "{{ service_name }}.service"
register: systemctl_result
changed_when: False

- name: "Print result"
ansible.builtin.debug:
var: systemctl_result
Loading