update junos_template module
This updates the junos_template module implementing the changes for Ansible 2.2
This commit is contained in:
parent
174ffde2e9
commit
f5e62a0611
1 changed files with 5 additions and 7 deletions
|
@ -100,6 +100,7 @@ EXAMPLES = """
|
||||||
src: config.j2
|
src: config.j2
|
||||||
action: overwrite
|
action: overwrite
|
||||||
"""
|
"""
|
||||||
|
from ansible.module_utils.junos import NetworkModule
|
||||||
|
|
||||||
DEFAULT_COMMENT = 'configured by junos_template'
|
DEFAULT_COMMENT = 'configured by junos_template'
|
||||||
|
|
||||||
|
@ -115,8 +116,8 @@ def main():
|
||||||
transport=dict(default='netconf', choices=['netconf'])
|
transport=dict(default='netconf', choices=['netconf'])
|
||||||
)
|
)
|
||||||
|
|
||||||
module = get_module(argument_spec=argument_spec,
|
module = NetworkModule(argument_spec=argument_spec,
|
||||||
supports_check_mode=True)
|
supports_check_mode=True)
|
||||||
|
|
||||||
comment = module.params['comment']
|
comment = module.params['comment']
|
||||||
confirm = module.params['confirm']
|
confirm = module.params['confirm']
|
||||||
|
@ -132,9 +133,9 @@ def main():
|
||||||
"set per junos documentation")
|
"set per junos documentation")
|
||||||
|
|
||||||
results = dict(changed=False)
|
results = dict(changed=False)
|
||||||
results['_backup'] = str(module.get_config()).strip()
|
results['_backup'] = str(module.config.get_config()).strip()
|
||||||
|
|
||||||
diff = module.load_config(src, action=action, comment=comment,
|
diff = module.config.load_config(src, action=action, comment=comment,
|
||||||
format=fmt, commit=commit, confirm=confirm)
|
format=fmt, commit=commit, confirm=confirm)
|
||||||
|
|
||||||
if diff:
|
if diff:
|
||||||
|
@ -144,8 +145,5 @@ def main():
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
|
||||||
from ansible.module_utils.junos import *
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue