[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" - "Restart neutron services"
- "venv changed" - "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 - name: Start services
service: service:
name: "{{ item.service_name }}" name: "{{ item.service_name }}"

View File

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