From 09b8badc5e1340e7affb3338b4aa89f4dce518dc Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Tue, 25 Apr 2017 23:09:55 +0530 Subject: [PATCH] Minor junos_config module changes (#23972) * Minor junos_config module changes * Add note for json config support * Add example for lines argument * Fix future warning for ElementTree * Remove unwanted space --- lib/ansible/modules/network/junos/junos_config.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/junos/junos_config.py b/lib/ansible/modules/network/junos/junos_config.py index a60098ab8f..9f49e14d38 100644 --- a/lib/ansible/modules/network/junos/junos_config.py +++ b/lib/ansible/modules/network/junos/junos_config.py @@ -45,7 +45,7 @@ options: src: description: - The I(src) argument provides a path to the configuration file - to load into the remote system. The path can either be a full + to load into the remote system. The path can either be a full system path to the configuration file if the value starts with / or relative to the root of the implemented role or playbook. This argument is mutually exclusive with the I(lines) argument. @@ -142,6 +142,8 @@ requirements: notes: - This module requires the netconf system service be enabled on the remote device being managed. + - Loading JSON-formatted configuration I(json) is supported + starting in Junos OS Release 16.1 onwards. """ EXAMPLES = """ @@ -151,6 +153,14 @@ EXAMPLES = """ comment: update config provider: "{{ netconf }}" +- name: load configure lines into device + junos_config: + lines: + - set interfaces ge-0/0/1 unit 0 description "Test interface" + - set vlans vlan01 description "Test vlan" + comment: update config + provider: "{{ netconf }}" + - name: rollback the configuration to id 10 junos_config: rollback: 10 @@ -330,7 +340,7 @@ def main(): else: diff = configure_device(module, warnings) - if diff: + if diff is not None: if module._diff: result['diff'] = {'prepared': diff} result['changed'] = True