From f67bf3f77570e6f0f57d04dc206a86016d42a3f7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sat, 27 Feb 2016 16:42:43 -0500 Subject: [PATCH] updates the ops_template plugin action backup key This commit changes the key the ops_template will search for in order to backup the current configuration to local disk on the Ansible control host. This change was made to make ops_template consistent with the other network template modules. --- lib/ansible/plugins/action/ops_template.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/plugins/action/ops_template.py b/lib/ansible/plugins/action/ops_template.py index 84924fdb74..4b45c03f5c 100644 --- a/lib/ansible/plugins/action/ops_template.py +++ b/lib/ansible/plugins/action/ops_template.py @@ -35,15 +35,15 @@ class ActionModule(NetActionModule, ActionBase): if isinstance(self._task.args['src'], basestring): self._handle_template() - self._task.args['config'] = task_vars.get('config') - result.update(self._execute_module(module_name=self._task.action, module_args=self._task.args, task_vars=task_vars)) - if self._task.args.get('backup') and '_config' in result: - contents = json.dumps(result['_config'], indent=4) + if self._task.args.get('backup') and result.get('_backup'): + contents = json.dumps(result['_backup'], indent=4) self._write_backup(task_vars['inventory_hostname'], contents) - del result['_config'] + + if '_backup' in result: + del result['_backup'] return result