use policy.yaml instead of policy.json due to latest change on gnocchi

Change-Id: If05936d25db3329b4204172f3b800ddf3417b9b7
This commit is contained in:
somayeh_hajiahmadi 2023-09-12 18:25:33 +03:30
parent 069d0498f6
commit f1f47cad9e
2 changed files with 54 additions and 11 deletions

View File

@ -30,8 +30,6 @@
listen:
- "Restart gnocchi services"
- "venv changed"
- "systemd service changed"
- "cert installed"
# Note (odyssey4me):
# The policy.json file is currently read continually by the services
@ -43,8 +41,8 @@
#
- name: Copy new policy file into place
copy:
src: "/etc/gnocchi/policy.json-{{ gnocchi_venv_tag }}"
dest: "/etc/gnocchi/policy.json"
src: "/etc/gnocchi/policy.yaml-{{ gnocchi_venv_tag }}"
dest: "/etc/gnocchi/policy.yaml"
owner: "root"
group: "{{ gnocchi_system_group_name }}"
mode: "0640"
@ -70,5 +68,13 @@
listen:
- "Restart gnocchi services"
- "venv changed"
- "systemd service changed"
- "cert installed"
# NOTE(noonedeadpunk): This task is created due to migration from apache to uwsgi
# which was introduced during train release. It can be dropped afterwards.
- name: Restart web server
service:
name: "{{ gnocchi_system_service_name }}"
enabled: yes
state: "restarted"
daemon_reload: yes
failed_when: false

View File

@ -25,7 +25,7 @@
- name: Copy gnocchi configuration files
openstack.config_template.config_template:
content: "{{ item.content | default(omit) }}"
src: "{{ item.src | default(omit) }}"
src: "{{ item.src | default(omit) }}"
dest: "{{ item.dest }}"
owner: "{{ item.owner | default(gnocchi_system_user_name) }}"
group: "{{ item.group | default(gnocchi_system_group_name) }}"
@ -41,10 +41,47 @@
config_overrides: "{{ gnocchi_api_paste_ini_overrides }}"
config_type: "ini"
content: "{{ gnocchi_api_paste_user_content | default(gnocchi_api_paste_default_content, true) }}"
- dest: "/etc/gnocchi/policy.json-{{ gnocchi_venv_tag }}"
config_overrides: "{{ gnocchi_policy_overrides }}"
config_type: "json"
content: "{{ gnocchi_policy_user_content | default(gnocchi_policy_default_content, true) }}"
notify:
- Restart gnocchi services
- Restart uwsgi services
- Restart web server
- name: Implement policy.yaml if there are overrides configured
openstack.config_template.config_template:
content: "{{ gnocchi_policy_overrides }}"
dest: "/etc/gnocchi/policy.yaml-{{ gnocchi_venv_tag }}"
owner: "root"
group: "{{ gnocchi_system_group_name }}"
mode: "0640"
config_type: yaml
when:
- gnocchi_policy_overrides | length > 0
tags:
- gnocchi-policy-override
- name: Remove legacy policy.yaml file
file:
path: "/etc/gnocchi/policy.yaml"
state: absent
when:
- gnocchi_policy_overrides | length == 0
tags:
- gnocchi-policy-override
# NOTE(noonedeadpunk): This task is created due to migration from apache to uwsgi
# which was introduced during train release. It can be dropped afterwards.
- name: Drop Apache related configs
file:
path: "{{ item }}"
state: absent
with_items: "{{ gnocchi_apache_config }}"
notify:
- Restart web server
- name: Stop Apache listening on Gnocchi port
lineinfile:
path: "{{ gnocchi_apache_ports }}"
state: absent
line: "Listen {{ gnocchi_service_port }}"
notify:
- Restart web server