Merge "[goal] Deprecate the JSON formatted policy file"

This commit is contained in:
Zuul 2021-04-06 12:33:11 +00:00 committed by Gerrit Code Review
commit e9177110fa
2 changed files with 22 additions and 30 deletions

View File

@ -27,34 +27,11 @@
- "Restart designate services"
- "venv changed"
# Note (odyssey4me):
# The policy.json file is currently read continually by the services
# and is not only read on service start. We therefore cannot template
# directly to the file read by the service because the new policies
# may not be valid until the service restarts. This is particularly
# important during a major upgrade. We therefore only put the policy
# file in place after the service has been stopped.
#
- name: Copy new policy file into place
copy:
src: "/etc/designate/policy.json-{{ designate_venv_tag }}"
dest: "/etc/designate/policy.json"
owner: "root"
group: "{{ designate_system_group_name }}"
mode: "0640"
remote_src: yes
when:
- designate_policy_overrides != {}
listen:
- "Restart designate services"
- "venv changed"
- name: Remove legacy policy.json file
# NOTE (noonedeadpunk): Remove this task after Xena release
- name: Remove obsoleted policy.json
file:
path: "/etc/designate/policy.json"
state: absent
when:
- designate_policy_overrides == {}
listen:
- "Restart designate services"
- "venv changed"

View File

@ -57,12 +57,27 @@
config_type: "ini"
notify: Restart designate services
- name: Implement policy.json if there are overrides configured
copy:
content: "{{ designate_policy_overrides | to_nice_json }}"
dest: "/etc/designate/policy.json-{{ designate_venv_tag }}"
- name: Implement policy.yaml if there are overrides configured
config_template:
content: "{{ designate_policy_overrides }}"
dest: "/etc/designate/policy.yaml"
owner: "{{ designate_system_user_name }}"
group: "{{ designate_system_group_name }}"
mode: "0644"
config_type: yaml
when:
- designate_policy_overrides != {}
- designate_policy_overrides | length > 0
tags:
- designate-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/designate/policy.yaml"
state: absent
when:
- designate_policy_overrides | length == 0
tags:
- designate-policy-override
- name: Create Designate pools.yaml file
copy: