330f8613ee
The change introduces the `config_template` plugin within our ansible source tree with the intention to replace the `copy_update` module with a proper ansible action plugin. The new module implements a method to overwrite and add items into configuration files without the need to specify all items in templates as default variables. The plugin currently supports ini, json, and yaml files and can be a drop in replacement for the current template and copy_update usage as it pertains to the various configuration files that we need for OpenStack. Partially implements: blueprint tunable-openstack-configuration Change-Id: Ice1d3e6b99976c0df780f2a1e9c3e6244c3e0114
67 lines
2.1 KiB
Plaintext
67 lines
2.1 KiB
Plaintext
# this is a virtual module that is entirely implemented server side
|
|
|
|
DOCUMENTATION = """
|
|
---
|
|
module: config_template
|
|
version_added: 1.9.2
|
|
short_description: Renders template files providing a create/update override interface
|
|
description:
|
|
- The module contains the template functionality with the ability to override items
|
|
in config, in transit, though the use of an simple dictionary without having to
|
|
write out various temp files on target machines. The module renders all of the
|
|
potential jinja a user could provide in both the template file and in the override
|
|
dictionary which is ideal for deployers whom may have lots of different configs
|
|
using a similar code base.
|
|
- The module is an extension of the **copy** module and all of attributes that can be
|
|
set there are available to be set here.
|
|
options:
|
|
src:
|
|
description:
|
|
- Path of a Jinja2 formatted template on the local server. This can be a relative
|
|
or absolute path.
|
|
required: true
|
|
default: null
|
|
dest:
|
|
description:
|
|
- Location to render the template to on the remote machine.
|
|
required: true
|
|
default: null
|
|
config_overrides:
|
|
description:
|
|
- A dictionary used to update or override items within a configuration template.
|
|
The dictionary data structure may be nested. If the target config file is an ini
|
|
file the nested keys in the ``config_overrides`` will be used as section
|
|
headers.
|
|
config_type:
|
|
description:
|
|
- A string value describing the target config type.
|
|
choices:
|
|
- ini
|
|
- json
|
|
- yaml
|
|
author: Kevin Carter
|
|
"""
|
|
|
|
EXAMPLES = """
|
|
- name: run config template ini
|
|
config_template:
|
|
src: templates/test.ini.j2
|
|
dest: /tmp/test.ini
|
|
config_overrides: {}
|
|
config_type: ini
|
|
|
|
- name: run config template json
|
|
config_template:
|
|
src: templates/test.json.j2
|
|
dest: /tmp/test.json
|
|
config_overrides: {}
|
|
config_type: json
|
|
|
|
- name: run config template yaml
|
|
config_template:
|
|
src: templates/test.yaml.j2
|
|
dest: /tmp/test.yaml
|
|
config_overrides: {}
|
|
config_type: yaml
|
|
"""
|