]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Add support for --diff in config_template
authorAndy McCrae <andy.mccrae@gmail.com>
Wed, 21 Mar 2018 15:57:00 +0000 (15:57 +0000)
committerSébastien Han <seb@redhat.com>
Wed, 18 Apr 2018 15:19:13 +0000 (17:19 +0200)
Add support for the Ansible --diff mode in config_template. This will
show the before/after for config_template changes, in the same way as
the base copy and template modules do.

To utilise this run your playbooks with "--diff --check".

plugins/actions/_v2_config_template.py

index 64d57c74570e6165a7c7f922fa45d96ef03f0d95..5a818176663c58fb3c4fea4c094180ed057d34eb 100644 (file)
@@ -564,8 +564,13 @@ class ActionModule(ActionBase):
         new_module_args.pop('list_extend', None)
 
         # Run the copy module
-        return self._execute_module(
+        rc = self._execute_module(
             module_name='copy',
             module_args=new_module_args,
             task_vars=task_vars
         )
+        if self._play_context.diff:
+            rc['diff'] = []
+            rc['diff'].append(self._get_diff_data(_vars['dest'],
+                              transferred_data, task_vars))
+        return rc