aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ansible/action_plugins/merge_configs.py35
-rwxr-xr-xansible/action_plugins/merge_yaml.py35
-rw-r--r--ansible/library/merge_configs.py51
-rw-r--r--ansible/library/merge_yaml.py51
4 files changed, 70 insertions, 102 deletions
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
diff --git a/ansible/library/merge_configs.py b/ansible/library/merge_configs.py
deleted file mode 100644
index 1a73e3101..000000000
--- a/ansible/library/merge_configs.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2015 Sam Yaple
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# 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"
-'''
diff --git a/ansible/library/merge_yaml.py b/ansible/library/merge_yaml.py
deleted file mode 100644
index 4d54b437d..000000000
--- a/ansible/library/merge_yaml.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2015 Sam Yaple
-# Copyright 2016 intel
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# 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"
-'''