Fix unintentional trigger of ansible handlers
Due to an Ansible quirk, when one container of a group changes, all containers in that group are restarted. This can cause problems with some services. The lower amount of containers restarted also speeds up deploy and reconfigure. Closes-bug: #1863510 Partially-implements: blueprint performance-improvements Signed-off-by: Roman Krček <roman.krcek@tietoevry.com> Change-Id: I699f9e7497bc1b384f383182d67233f3e0e165d1
This commit is contained in:
parent
345ecbf55e
commit
fc0e0fb821
@ -4,7 +4,6 @@
|
||||
- name: "{{ kolla_role_name | default(project_name) }} | Check containers"
|
||||
become: true
|
||||
vars:
|
||||
service_name: "{{ item.key }}"
|
||||
service: "{{ item.value }}"
|
||||
kolla_container:
|
||||
action: "compare_container"
|
||||
@ -26,5 +25,13 @@
|
||||
command: "{{ service.command | default(omit) }}"
|
||||
cgroupns_mode: "{{ service.cgroupns_mode | default(omit) }}"
|
||||
with_dict: "{{ lookup('vars', (kolla_role_name | default(project_name)) + '_services') | select_services_enabled_and_mapped_to_host }}"
|
||||
notify:
|
||||
- "Restart {{ service_name }} container"
|
||||
register: container_check
|
||||
|
||||
# NOTE(yoctozepto): Must be a separate task because one cannot see the whole
|
||||
# result in the previous task and Ansible has a quirk regarding notifiers.
|
||||
# For details see https://github.com/ansible/ansible/issues/22579
|
||||
- name: "{{ kolla_role_name | default(project_name) }} | Notify handlers to restart containers"
|
||||
debug:
|
||||
msg: Notifying handlers
|
||||
changed_when: container_check is changed
|
||||
notify: "{{ container_check.results | select('changed') | map(attribute='item.key') | map('regex_replace', '^(.*)$', 'Restart \\1 container') | list }}"
|
||||
|
8
releasenotes/notes/bug-1863510-e39da141cdd07c41.yaml
Normal file
8
releasenotes/notes/bug-1863510-e39da141cdd07c41.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix unintentional trigger of ansible handlers.
|
||||
Due to an Ansible quirk, when one container of a group
|
||||
changes, all containers in that group are restarted.
|
||||
This can cause problems with some services.
|
||||
`LP#1863510 <https://launchpad.net/bugs/1863510>`__
|
Loading…
x
Reference in New Issue
Block a user