From 2de509d108125fed803f62cc48c9ca9ab4da85c0 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 14 Sep 2015 11:17:13 -0500 Subject: [PATCH] Adds the config_template to cinder The change modifies the cinder 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: I463bbd3e10895dc2e7788346493f78bc46e5f26e --- playbooks/roles/os_cinder/defaults/main.yml | 6 +++ .../os_cinder/tasks/cinder_post_install.yml | 40 ++++++++++--------- .../rootwrap.conf.j2} | 0 3 files changed, 27 insertions(+), 19 deletions(-) rename playbooks/roles/os_cinder/{files/rootwrap.conf => templates/rootwrap.conf.j2} (100%) diff --git a/playbooks/roles/os_cinder/defaults/main.yml b/playbooks/roles/os_cinder/defaults/main.yml index 0ac6a57f9a..07c414979d 100644 --- a/playbooks/roles/os_cinder/defaults/main.yml +++ b/playbooks/roles/os_cinder/defaults/main.yml @@ -222,3 +222,9 @@ cinder_service_names: - cinder-scheduler - cinder-volume - cinder-backup + +## Tunable overrides +cinder_policy_overrides: {} +cinder_rootwrap_conf_overrides: {} +cinder_api_paste_ini_overrides: {} +cinder_cinder_conf_overrides: {} diff --git a/playbooks/roles/os_cinder/tasks/cinder_post_install.yml b/playbooks/roles/os_cinder/tasks/cinder_post_install.yml index c3ca0b3435..263fd99be0 100644 --- a/playbooks/roles/os_cinder/tasks/cinder_post_install.yml +++ b/playbooks/roles/os_cinder/tasks/cinder_post_install.yml @@ -13,15 +13,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Generate cinder configs - template: +- name: Copy cinder configs + config_template: src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "{{ cinder_system_user_name }}" group: "{{ cinder_system_group_name }}" + mode: "0644" + config_overrides: "{{ item.config_overrides }}" + config_type: "{{ item.config_type }}" with_items: - - { src: "cinder.conf.j2", dest: "/etc/cinder/cinder.conf" } - - { src: "api-paste.ini.j2", dest: "/etc/cinder/api-paste.ini" } + - src: "cinder.conf.j2" + dest: "/etc/cinder/cinder.conf" + config_overrides: "{{ cinder_cinder_conf_overrides }}" + config_type: "ini" + - src: "api-paste.ini.j2" + dest: "/etc/cinder/api-paste.ini" + config_overrides: "{{ cinder_api_paste_ini_overrides }}" + config_type: "ini" + - src: "rootwrap.conf.j2" + dest: "/etc/cinder/rootwrap.conf" + config_overrides: "{{ cinder_rootwrap_conf_overrides }}" + config_type: "ini" + - src: "policy.json" + dest: "/etc/cinder/policy.json" + config_overrides: "{{ cinder_policy_overrides }}" + config_type: "json" notify: - Restart cinder services tags: @@ -35,21 +52,6 @@ group: "{{ cinder_system_group_name }}" with_items: - { src: "volume.filters", dest: "/etc/cinder/rootwrap.d/volume.filters" } - - { src: "rootwrap.conf", dest: "/etc/cinder/rootwrap.conf" } - notify: - - Restart cinder services - tags: - - cinder-config - -- name: Apply updates to Policy file - config_template: - src: "policy.json" - dest: "/etc/cinder/policy.json" - owner: "{{ cinder_system_user_name }}" - group: "{{ cinder_system_group_name }}" - mode: "0644" - config_overrides: "{{ cinder_policy_overrides|default({}) }}" - config_type: "json" notify: - Restart cinder services tags: diff --git a/playbooks/roles/os_cinder/files/rootwrap.conf b/playbooks/roles/os_cinder/templates/rootwrap.conf.j2 similarity index 100% rename from playbooks/roles/os_cinder/files/rootwrap.conf rename to playbooks/roles/os_cinder/templates/rootwrap.conf.j2