Stop using need_service_restart local fact

We can reduce complexity of logic on when to restart glance as we
anyway leverage in-role handlers to restart service when needed.

Patch adds also triggering service restart when install_packages
are changed.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/866693
Change-Id: Ieeeb9bc3b8922700e0c70f150cf1af0a75c805ea
Needed-By: https://review.opendev.org/c/openstack/openstack-ansible/+/866126
This commit is contained in:
Dmitriy Rabotyagov 2022-12-06 12:12:03 +01:00
parent 504e641ed4
commit ee521f91f2
1 changed files with 2 additions and 12 deletions

View File

@ -114,6 +114,8 @@
until: install_packages is success
retries: 5
delay: 2
notify:
- "Restart glance services"
- name: Install the python venv
import_role:
@ -130,23 +132,11 @@
union(glance_user_pip_packages) |
union(((glance_oslomsg_amqp1_enabled | bool) | ternary(glance_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "glance"
option: "need_service_restart"
value: True
- section: "glance"
option: "venv_tag"
value: "{{ glance_venv_tag }}"
when: glance_install_method == 'source'
- name: Record the need for a service restart
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: "glance"
option: "need_service_restart"
value: true
when: (install_packages is changed) or
('need_service_restart' not in ansible_local['openstack_ansible']['glance'])
- name: Run the systemd service role
include_role:
name: systemd_service