diff --git a/defaults/main.yml b/defaults/main.yml index 9e30e8d..57000d8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -215,14 +215,13 @@ gnocchi_memcached_servers: "{{ memcached_servers }}" # not exist then the default files will be sourced from the # service git repository. gnocchi_api_paste_default_file_path: "/etc/openstack_deploy/gnocchi/api-paste.ini" -gnocchi_policy_default_file_path: "/etc/openstack_deploy/gnocchi/policy.json" +gnocchi_policy_default_file_path: "/etc/openstack_deploy/gnocchi/policy.yaml" # If the above-mentioned files do not exist, then these # paths will be used to find the files from the git config # lookup location. gnocchi_git_config_lookup_location: https://raw.githubusercontent.com/gnocchixyz/gnocchi/{{ gnocchi_git_install_branch }}/ gnocchi_api_paste_git_file_path: "gnocchi/rest/api-paste.ini" -gnocchi_policy_git_file_path: "gnocchi/rest/policy.json" # Tunable var-based overrides # The contents of these are templated over the default files. diff --git a/handlers/main.yml b/handlers/main.yml index 8867dea..7b6675e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -34,7 +34,7 @@ - "cert installed" # Note (odyssey4me): -# The policy.json file is currently read continually by the services +# The policy.yaml 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 @@ -49,6 +49,7 @@ group: "{{ gnocchi_system_group_name }}" mode: "0640" remote_src: yes + when: gnocchi_policy_user_content | length > 0 listen: - "Restart gnocchi services" - "venv changed" diff --git a/tasks/gnocchi_post_install.yml b/tasks/gnocchi_post_install.yml index 00abfc9..08bea16 100644 --- a/tasks/gnocchi_post_install.yml +++ b/tasks/gnocchi_post_install.yml @@ -19,7 +19,6 @@ return_content: yes with_items: - "{{ gnocchi_git_config_lookup_location }}/{{ gnocchi_api_paste_git_file_path }}" - - "{{ gnocchi_git_config_lookup_location }}/{{ gnocchi_policy_git_file_path }}" register: _git_file_fetch - name: Copy gnocchi configuration files @@ -32,6 +31,7 @@ mode: "{{ item.mode | default('0644') }}" config_overrides: "{{ item.config_overrides }}" config_type: "{{ item.config_type }}" + when: "{{ item.condition }}" with_items: - src: "gnocchi.conf.j2" dest: "/etc/gnocchi/gnocchi.conf" @@ -44,7 +44,8 @@ - dest: "/etc/gnocchi/policy.yaml-{{ gnocchi_venv_tag }}" config_overrides: "{{ gnocchi_policy_overrides }}" config_type: "yaml" - content: "{{ gnocchi_policy_user_content | default(gnocchi_policy_default_content, true) }}" + content: "{{ gnocchi_policy_user_content }}" + condition: gnocchi_policy_user_content | length > 0 notify: - Restart gnocchi services - Restart uwsgi services diff --git a/vars/main.yml b/vars/main.yml index 571ec1e..b77070b 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -29,11 +29,6 @@ gnocchi_api_paste_default_content: | _git_file_fetch.results | selectattr( 'item', 'equalto', gnocchi_git_config_lookup_location ~ '/' ~ gnocchi_api_paste_git_file_path) | map(attribute='content') | first }} -gnocchi_policy_default_content: | - {{ - _git_file_fetch.results | selectattr( - 'item', 'equalto', gnocchi_git_config_lookup_location ~ '/' ~ gnocchi_policy_git_file_path) | map(attribute='content') | first - }} # NOTE(noonedeadpunk): We prefer using ceph_alternative when storage driver is ceph. # However, if we define ceph_alternative here, gnocchi with setup.cfg