[goal] Deprecate the JSON formatted policy file

As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to replace policy.json to
policy.yaml and remove deprecated policy.json.

config_template has been choosen instead of the copy, since it can
properly handle content that has been lookuped.

We make a separate task not to restart service when it's not needed.

[1] https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: Ib47a387f15e358e15104fd1cf37e53e61c92ce61
This commit is contained in:
Dmitriy Rabotyagov 2021-03-22 17:30:53 +02:00 committed by Dmitriy Rabotyagov
parent e06c25eaa1
commit d1c775f996
2 changed files with 26 additions and 7 deletions

View File

@ -82,6 +82,14 @@
- "Restart neutron services"
- "venv changed"
# NOTE (noonedeadpunk): Remove this task after Xena release
- name: Remove obsoleted policy.json
file:
path: "/etc/neutron/policy.json"
state: absent
listen:
- "Restart neutron services"
- name: Start services
service:
name: "{{ item.service_name }}"

View File

@ -63,17 +63,28 @@
notify:
- Restart neutron services
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ neutron_policy_overrides | to_nice_json }}"
dest: "{{ neutron_conf_dir }}/policy.json"
notify:
- Restart neutron services
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ neutron_policy_overrides }}"
dest: "{{ neutron_conf_dir }}/policy.yaml"
owner: "root"
group: "{{ neutron_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- neutron_policy_overrides != {}
- neutron_policy_overrides | length > 0
tags:
- neutron-policy-overrides
- name: Remove legacy policy.yaml file
file:
path: "/etc/neutron/policy.yaml"
state: absent
when:
- neutron_policy_overrides | length == 0
tags:
- neutron-policy-override
- name: Place api-paste.ini to the correct path in RedHat
file:
src: "/usr/share/neutron/api-paste.ini"