Skip to content

Commit

Permalink
Merge "Fix unintentional trigger of ansible handlers"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Dec 3, 2024
2 parents afa4282 + fc0e0fb commit a11a043
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ansible/roles/service-check-containers/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 changes: 8 additions & 0 deletions releasenotes/notes/bug-1863510-e39da141cdd07c41.yaml
Original file line number Diff line number Diff line change
@@ -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>`__

0 comments on commit a11a043

Please sign in to comment.