Skip to content

Commit

Permalink
Retry beat service state checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nkakouros authored Aug 25, 2024
1 parent 9726357 commit 41b7552
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
- name: "{{ beats_flavor }}: Get service facts"
service_facts: ~
listen: beats-restart-service

- name: "{{ beats_flavor }}: Check that beats service has started successfully"
assert:
that: "ansible_facts.services['{{ beats_service_name }}.service']['state'] == 'running'"
msg: "{{ beats_service_name }}.service failed to start"
listen: beats-restart-service
register: _result
retries: 4
# No need for delay, getting the service facts is a slow task anyway.
failed_when:
- _result.ansible_facts.services[beats_service_name + '.service']['state'] != 'running'
when:
- beats_enable_service | bool
- ansible_os_family != 'Windows'
Expand Down

0 comments on commit 41b7552

Please sign in to comment.