Do not remove policy.yaml file

oslo.policy can not handle policy file removal. As a result, if policy
overrides were defined at some point, but then removed, causes service
outage.

While we could add a handler trigger to restart the service
on policy removal, it's better to simplify the logic and always place an
empty policy.yaml even if no overrides are defined.

Change-Id: Ibe0883ff684ef7e7db9c0858956163e314c208d0
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
This commit is contained in:
Dmitriy Rabotyagov
2025-11-14 12:41:54 +01:00
parent 02b64f1ad4
commit d80a1a0b02

View File

@@ -59,22 +59,13 @@
- zun-config
- zun-post-install
- name: Implement policy.yaml if there are overrides configured
- name: Implement policy.yaml file
openstack.config_template.config_template:
content: "{{ zun_policy_overrides }}"
dest: "/etc/zun/policy.yaml"
config_type: yaml
when:
- zun_policy_overrides | length > 0
tags:
- zun-policy-override
- name: Remove legacy policy.yaml file
ansible.builtin.file:
path: "/etc/zun/policy.yaml"
state: absent
when:
- zun_policy_overrides | length == 0
- zun_services['zun-api']['group'] in group_names
tags:
- zun-policy-override