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
This commit is contained in:
Jimmy McCrory 2016-01-11 16:29:02 -08:00 committed by Jesse Pretorius (odyssey4me)
parent 2b6c9c39fa
commit 6cb79b61fa
2 changed files with 22 additions and 3 deletions

View File

@ -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.

View File

@ -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()