aboutsummaryrefslogtreecommitdiff
path: root/ansible/action_plugins
diff options
context:
space:
mode:
authorcaoyuan <cao.yuan@99cloud.net>2018-10-22 22:37:11 +0800
committercaoyuan <cao.yuan@99cloud.net>2018-10-31 10:13:00 +0800
commit8ee47ae3a29e8f2a5d227701dac9f7597a26a97d (patch)
tree03376933a0e2d90587e5b49c005590c6b27bfc6d /ansible/action_plugins
parent1731f81fa09c4a397e645de52b2671f255f322ae (diff)
downloadkolla-ansible-8ee47ae3a29e8f2a5d227701dac9f7597a26a97d.tar.gz
kolla-ansible-8ee47ae3a29e8f2a5d227701dac9f7597a26a97d.zip
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
Diffstat (limited to 'ansible/action_plugins')
-rw-r--r--ansible/action_plugins/merge_configs.py35
-rwxr-xr-xansible/action_plugins/merge_yaml.py35
2 files changed, 70 insertions, 0 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