From 6cb79b61fa3e2cc8084e36b2db470fa8bce3ec68 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Mon, 11 Jan 2016 16:29:02 -0800 Subject: [PATCH] Update plugin for and document per host overrides Ensure that configuration section and key names are strings, as required by RawConfigParser.write. Document an example of overriding openstack configurations on a per host basis. Closes-Bug: #1536957 Change-Id: I6b641715766eb11910fcf7479e260f0e16cc1657 --- .../install-guide/configure-openstack.rst | 19 +++++++++++++++++++ playbooks/plugins/actions/config_template.py | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/source/install-guide/configure-openstack.rst b/doc/source/install-guide/configure-openstack.rst index ec2b9d379d..5cb2fa71d7 100644 --- a/doc/source/install-guide/configure-openstack.rst +++ b/doc/source/install-guide/configure-openstack.rst @@ -57,6 +57,25 @@ entry in ``/etc/openstack_deploy/user_variables.yml``: idle_timeout: 300 max_pool_size: 10 +Overrides may also be applied on a per host basis with the following +configuration in ``/etc/openstack_deploy/openstack_user_config.yml``: + +.. code-block:: yaml + + compute_hosts: + 900089-compute001: + ip: 192.0.2.10 + host_vars: + nova_nova_conf_overrides: + DEFAULT: + remove_unused_original_minimum_age_seconds: 43200 + libvirt: + cpu_mode: host-model + disk_cachemodes: file=directsync,block=none + database: + idle_timeout: 300 + max_pool_size: 10 + This method may be used for any INI file format for all OpenStack projects deployed in OpenStack-Ansible. diff --git a/playbooks/plugins/actions/config_template.py b/playbooks/plugins/actions/config_template.py index 3fee5d9e6b..fdb8d5dafc 100644 --- a/playbooks/plugins/actions/config_template.py +++ b/playbooks/plugins/actions/config_template.py @@ -67,17 +67,17 @@ class ActionModule(object): # If the items value is not a dictionary it is assumed that the # value is a default item for this config type. if not isinstance(items, dict): - config.set('DEFAULT', section, str(items)) + config.set('DEFAULT', str(section), str(items)) else: # Attempt to add a section to the config file passing if # an error is raised that is related to the section # already existing. try: - config.add_section(section) + config.add_section(str(section)) except (ConfigParser.DuplicateSectionError, ValueError): pass for key, value in items.items(): - config.set(section, key, str(value)) + config.set(str(section), str(key), str(value)) else: config_object.close()