From 1e46243feab19f3fd38819a61c1115a0b31dfe73 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 14 Sep 2015 15:39:35 -0500 Subject: [PATCH] Adds the config_template to glance The change modifies the glance template tasks such that it's now using the config_template action plugin. This change will make so that config files can be dynamically updated, by a deployer, at run time, without requiring the need to modify the in tree templates or defaults. Partially implements: blueprint tunable-openstack-configuration Change-Id: I13fc6f38679267a84104cae948517d185e9f4ece --- playbooks/roles/os_glance/defaults/main.yml | 11 +++ .../os_glance/tasks/glance_post_install.yml | 84 ++++++++++--------- .../templates/{policy.json => policy.json.j2} | 0 .../schema.json => templates/schema.json.j2} | 0 4 files changed, 56 insertions(+), 39 deletions(-) rename playbooks/roles/os_glance/templates/{policy.json => policy.json.j2} (100%) rename playbooks/roles/os_glance/{files/schema.json => templates/schema.json.j2} (100%) diff --git a/playbooks/roles/os_glance/defaults/main.yml b/playbooks/roles/os_glance/defaults/main.yml index 601e40a575..c5b6a22c1c 100644 --- a/playbooks/roles/os_glance/defaults/main.yml +++ b/playbooks/roles/os_glance/defaults/main.yml @@ -168,3 +168,14 @@ glance_pip_packages: glance_service_names: - "glance-api" - "glance-registry" + +## Tunable overrides +glance_glance_api_paste_ini_overrides: {} +glance_glance_api_conf_overrides: {} +glance_glance_cache_conf_overrides: {} +glance_glance_manage_conf_overrides: {} +glance_glance_registry_paste_ini_overrides: {} +glance_glance_registry_conf_overrides: {} +glance_glance_scrubber_conf_overrides: {} +glance_glance_scheme_json_overrides: {} +glance_policy_overrides: {} \ No newline at end of file diff --git a/playbooks/roles/os_glance/tasks/glance_post_install.yml b/playbooks/roles/os_glance/tasks/glance_post_install.yml index ae8bd49ee7..cc3e262675 100644 --- a/playbooks/roles/os_glance/tasks/glance_post_install.yml +++ b/playbooks/roles/os_glance/tasks/glance_post_install.yml @@ -33,49 +33,55 @@ - glance-cron - name: Drop Glance Config(s) - template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: "{{ glance_system_user_name }}" - group: "{{ glance_system_group_name }}" - with_items: - - { src: "glance-api-paste.ini.j2", dest: "/etc/glance/glance-api-paste.ini" } - - { src: "glance-registry-paste.ini.j2", dest: "/etc/glance/glance-registry-paste.ini" } - - { src: "glance-api.conf.j2", dest: "/etc/glance/glance-api.conf" } - - { src: "glance-cache.conf.j2", dest: "/etc/glance/glance-cache.conf" } - - { src: "glance-manage.conf.j2", dest: "/etc/glance/glance-manage.conf" } - - { src: "glance-registry.conf.j2", dest: "/etc/glance/glance-registry.conf" } - - { src: "glance-scrubber.conf.j2", dest: "/etc/glance/glance-scrubber.conf" } - notify: - - Restart glance api - - Restart glance registry - tags: - - glance-config - -- name: Drop Glance static Config(s) - copy: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: "{{ glance_system_user_name }}" - group: "{{ glance_system_group_name }}" - with_items: - - { src: "schema.json", dest: "/etc/glance/schema.json" } - - { src: "schema.json", dest: "/etc/glance/schema-image.json" } - notify: - - Restart glance api - - Restart glance registry - tags: - - glance-config - -- name: Apply updates to Policy file config_template: - src: "policy.json" - dest: "/etc/glance/policy.json" + src: "{{ item.src }}" + dest: "{{ item.dest }}" owner: "{{ glance_system_user_name }}" group: "{{ glance_system_group_name }}" mode: "0644" - config_overrides: "{{ glance_policy_overrides|default({}) }}" - config_type: "json" + config_overrides: "{{ item.config_overrides }}" + config_type: "{{ item.config_type }}" + with_items: + - src: "glance-api-paste.ini.j2" + dest: "/etc/glance/glance-api-paste.ini" + config_overrides: "{{ glance_glance_api_paste_ini_overrides }}" + config_type: "ini" + - src: "glance-api.conf.j2" + dest: "/etc/glance/glance-api.conf" + config_overrides: "{{ glance_glance_api_conf_overrides }}" + config_type: "ini" + - src: "glance-cache.conf.j2" + dest: "/etc/glance/glance-cache.conf" + config_overrides: "{{ glance_glance_cache_conf_overrides }}" + config_type: "ini" + - src: "glance-manage.conf.j2" + dest: "/etc/glance/glance-manage.conf" + config_overrides: "{{ glance_glance_manage_conf_overrides }}" + config_type: "ini" + - src: "glance-registry-paste.ini.j2" + dest: "/etc/glance/glance-registry-paste.ini" + config_overrides: "{{ glance_glance_registry_paste_ini_overrides }}" + config_type: "ini" + - src: "glance-registry.conf.j2" + dest: "/etc/glance/glance-registry.conf" + config_overrides: "{{ glance_glance_registry_conf_overrides }}" + config_type: "ini" + - src: "glance-scrubber.conf.j2" + dest: "/etc/glance/glance-scrubber.conf" + config_overrides: "{{ glance_glance_scrubber_conf_overrides }}" + config_type: "ini" + - src: "policy.json.j2" + dest: "/etc/glance/policy.json" + config_overrides: "{{ glance_policy_overrides }}" + config_type: "json" + - src: "schema.json.j2" + dest: "/etc/glance/schema.json" + config_overrides: "{{ glance_glance_scheme_json_overrides }}" + config_type: "json" + - src: "schema.json.j2" + dest: "/etc/glance/schema-image.json" + config_overrides: "{{ glance_glance_scheme_json_overrides }}" + config_type: "json" notify: - Restart glance api - Restart glance registry diff --git a/playbooks/roles/os_glance/templates/policy.json b/playbooks/roles/os_glance/templates/policy.json.j2 similarity index 100% rename from playbooks/roles/os_glance/templates/policy.json rename to playbooks/roles/os_glance/templates/policy.json.j2 diff --git a/playbooks/roles/os_glance/files/schema.json b/playbooks/roles/os_glance/templates/schema.json.j2 similarity index 100% rename from playbooks/roles/os_glance/files/schema.json rename to playbooks/roles/os_glance/templates/schema.json.j2