Provide facility for a complete file override

Instead of forcing the use of config_override, this patch
provides a facility where the deployer can place a file
in /etc/openstack_deploy on the deployment host. The file
will be interpreted through the template engine (allowing
jinja to be used in the file) and placed on the target host.

If the file is not found, the fallback will be the default
file in the git source.

The patch also ensures that the curl is silent and therefore
does not show the download progress bar on the deployment
host when it executes.

Change-Id: Ieab7eab7f902741e62e1d2a49191010f8fd38442
This commit is contained in:
Jesse Pretorius 2017-02-13 14:52:25 +00:00
parent e869c8e14c
commit 8aa6fcd121
3 changed files with 25 additions and 2 deletions

View File

@ -167,7 +167,17 @@ gnocchi_pip_packages:
# by the py_pkgs lookup.
gnocchi_role_project_group: gnocchi_all
#: Tunable overrides
#: Tunable file-based overrides
# The contents of these files, if they exist, are read from the
# specified path on the deployment host, interpreted by the
# template engine and copied to the target host. If they do
# 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"
#: Tunable var-based overrides
# The contents of these are templated over the default files.
gnocchi_conf_overrides: {}
gnocchi_api_paste_ini_overrides: {}
gnocchi_policy_overrides: {}

View File

@ -0,0 +1,7 @@
---
features:
- The ``os_gnocchi`` role now includes a facility where you can place your
own default ``api-paste.ini`` or ``policy.json`` file in
``/etc/openstack_deploy/gnocchi`` (by default) and it will be
deployed to the target host after being interpreted by the
template engine.

View File

@ -28,7 +28,7 @@
- name: Retrieve and config_template upstream files
config_template:
content: "{{ lookup('pipe', 'curl ' ~ gnocchi_git_config_lookup_location ~ item.path | default('gnocchi/rest/') ~ item.name + '?h=' ~ gnocchi_git_install_branch) | string }}"
content: "{{ lookup('pipe', item.content) | string }}"
dest: "{{ item.dest }}"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
@ -37,10 +37,16 @@
dest: "/etc/gnocchi/api-paste.ini"
config_overrides: "{{ gnocchi_api_paste_ini_overrides }}"
config_type: "ini"
content: |
cat {{ gnocchi_api_paste_default_file_path }} 2>/dev/null || \
curl -s {{ gnocchi_git_config_lookup_location }}gnocchi/rest/api-paste.ini?h={{ gnocchi_git_install_branch }}
- name: "policy.json"
dest: "/etc/gnocchi/policy.json"
config_overrides: "{{ gnocchi_policy_overrides }}"
config_type: "json"
content: |
cat {{ gnocchi_policy_default_file_path }} 2>/dev/null || \
curl -s {{ gnocchi_git_config_lookup_location }}gnocchi/rest/policy.json?h={{ gnocchi_git_install_branch }}
notify:
- Restart Apache
- Restart Gnocchi services