Do not use notify inside handlers

Since latest ansible handlers are not triggered inside the same
handlers flush, which means that triggering mysql restart
the way we did does not work anymore. So instead of
notifying inside handlers, we add listen key to tasks
that are triggered by these newly produced notifications.

This could be due to the bug [1], but ansible-core version that has
backport included still shows inconsistent behaviour

[1] https://github.com/ansible/ansible/issues/80880

Change-Id: I0d97e0b90a8d18a7b69e880e4effa851238d51d1
This commit is contained in:
Dmitriy Rabotyagov 2023-07-18 12:37:44 +02:00 committed by Dmitriy Rabotyagov
parent c0da2e5095
commit b6e04fea1f

View File

@ -17,7 +17,6 @@
shell: >-
cat {{ item_base_path ~ '.crt' }} $(test -f {{ item_base_path ~ '-ca.crt' }} &&
echo {{ item_base_path ~ '-ca.crt' }}) {{ item_base_path ~ '.key' }} > {{ item_base_path ~ '.pem' }}
notify: Reload haproxy
vars:
item_interface: "{{ item['interface'] | default('') }}"
item_name: "{{ ('interface' in item and item['interface'] is truthy) | ternary(item['address'] ~ '-' ~ item_interface, item['address']) }}"
@ -35,7 +34,6 @@
mode: "0640"
owner: haproxy
group: haproxy
notify: Reload haproxy
with_items: "{{ all_changed_results | map(attribute='item') | flatten | selectattr('name', 'defined') | map(attribute='name') | unique }}"
- name: Regenerate haproxy configuration
@ -46,7 +44,6 @@
mode: "0640"
owner: haproxy
group: haproxy
notify: Reload haproxy
tags:
- haproxy-general-config
@ -70,3 +67,7 @@
state: "reloaded"
enabled: yes
daemon_reload: yes
listen:
- Regen pem
- Regenerate maps
- Regenerate haproxy configuration