mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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.
This commit is contained in:
parent
f99ed97c40
commit
f67bf3f775
1 changed files with 5 additions and 5 deletions
|
@ -35,15 +35,15 @@ class ActionModule(NetActionModule, ActionBase):
|
||||||
if isinstance(self._task.args['src'], basestring):
|
if isinstance(self._task.args['src'], basestring):
|
||||||
self._handle_template()
|
self._handle_template()
|
||||||
|
|
||||||
self._task.args['config'] = task_vars.get('config')
|
|
||||||
|
|
||||||
result.update(self._execute_module(module_name=self._task.action,
|
result.update(self._execute_module(module_name=self._task.action,
|
||||||
module_args=self._task.args, task_vars=task_vars))
|
module_args=self._task.args, task_vars=task_vars))
|
||||||
|
|
||||||
if self._task.args.get('backup') and '_config' in result:
|
if self._task.args.get('backup') and result.get('_backup'):
|
||||||
contents = json.dumps(result['_config'], indent=4)
|
contents = json.dumps(result['_backup'], indent=4)
|
||||||
self._write_backup(task_vars['inventory_hostname'], contents)
|
self._write_backup(task_vars['inventory_hostname'], contents)
|
||||||
del result['_config']
|
|
||||||
|
if '_backup' in result:
|
||||||
|
del result['_backup']
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue