From 8ee47ae3a29e8f2a5d227701dac9f7597a26a97d Mon Sep 17 00:00:00 2001 From: caoyuan Date: Mon, 22 Oct 2018 22:37:11 +0800 Subject: Merge the merge_yaml and merge_config module into one move the merge_yaml and merge_config module's DOCUMENTATION and EXAMPLES into action_plugins. Change-Id: I84c5b94afb870fc9a25838782389f7b1f8b882fd Closes-Bug: #1799236 --- ansible/action_plugins/merge_configs.py | 35 +++++++++++++++++++++++++++++++++ ansible/action_plugins/merge_yaml.py | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) (limited to 'ansible/action_plugins') diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py index 4377dd8c1..bc5df494e 100644 --- a/ansible/action_plugins/merge_configs.py +++ b/ansible/action_plugins/merge_configs.py @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # limitations under the License. +DOCUMENTATION = ''' +--- +module: merge_configs +short_description: Merge ini-style configs +description: + - ConfigParser is used to merge several ini-style configs into one +options: + dest: + description: + - The destination file name + required: True + type: str + sources: + description: + - A list of files on the destination node to merge together + default: None + required: True + type: str +author: Sam Yaple +''' + +EXAMPLES = ''' +Merge multiple configs: + +- hosts: database + tasks: + - name: Merge configs + merge_configs: + sources: + - "/tmp/config_1.cnf" + - "/tmp/config_2.cnf" + - "/tmp/config_3.cnf" + dest: + - "/etc/mysql/my.cnf" +''' import collections import inspect diff --git a/ansible/action_plugins/merge_yaml.py b/ansible/action_plugins/merge_yaml.py index 371905d0d..98648b6e0 100755 --- a/ansible/action_plugins/merge_yaml.py +++ b/ansible/action_plugins/merge_yaml.py @@ -15,6 +15,41 @@ # See the License for the specific language governing permissions and # limitations under the License. +DOCUMENTATION = ''' +--- +module: merge_yaml +short_description: Merge yaml-style configs +description: + - PyYAML is used to merge several yaml files into one +options: + dest: + description: + - The destination file name + required: True + type: str + sources: + description: + - A list of files on the destination node to merge together + default: None + required: True + type: str +author: Sean Mooney +''' + +EXAMPLES = ''' +Merge multiple yaml files: + +- hosts: localhost + tasks: + - name: Merge yaml files + merge_yaml: + sources: + - "/tmp/default.yml" + - "/tmp/override.yml" + dest: + - "/tmp/out.yml" +''' + import inspect import os import shutil -- cgit v1.2.3