[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: I3ff3ce4f150854ece690f1bcbd7183f511fccf2e
This commit is contained in:
Dmitriy Rabotyagov 2021-03-22 18:01:35 +02:00
parent 78657cee37
commit da09cb83bb
2 changed files with 28 additions and 9 deletions

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

@ -81,16 +81,26 @@
- nova-config
- nova-post-install
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ nova_policy_overrides | to_nice_json }}"
dest: "/etc/nova/policy.json"
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ nova_policy_overrides }}"
dest: "/etc/nova/policy.yaml"
owner: "root"
group: "{{ nova_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- nova_policy_overrides != {}
notify:
- Manage LB
- Restart nova services
- Restart uwsgi services
- nova_policy_overrides | length > 0
tags:
- nova-config
- nova-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/nova/policy.yaml"
state: absent
when:
- nova_policy_overrides | length == 0
tags:
- nova-config
- nova-policy-override