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: I3e96cbc9150e5051db19b3a93d68baf243beb17c
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
This commit is contained in:
Dmitriy Rabotyagov
2025-11-14 11:21:58 +01:00
parent 2597fe1579
commit 4316674349

View File

@@ -43,7 +43,7 @@
tags:
- cloudkitty-config
- name: Implement policy.yaml if there are overrides configured
- name: Place policy.yaml file
openstack.config_template.config_template:
dest: "/etc/cloudkitty/policy.yaml"
content: "{{ cloudkitty_policy_overrides }}"
@@ -51,18 +51,6 @@
group: "{{ cloudkitty_system_group_name }}"
mode: "0644"
config_type: "yaml"
when:
- cloudkitty_policy_overrides | length > 0
tags:
- cloudkitty-policy-override
- cloudkitty-config
- name: Remove legacy policy.yaml file
ansible.builtin.file:
path: "/etc/cloudkitty/policy.yaml"
state: absent
when:
- cloudkitty_policy_overrides | length == 0
tags:
- cloudkitty-policy-override
- cloudkitty-config