netconf_config – netconf device configuration¶
Synopsis¶
Netconf is a network management protocol developed and standardized by the IETF. It is documented in RFC 6241.
This module allows the user to send a configuration XML file to a netconf device, and detects if there was a configuration change.
Parameters¶
Notes¶
Note
This module requires the netconf system service be enabled on the remote device being managed.
This module supports devices with and without the candidate and confirmed-commit capabilities. It will always use the safer feature.
This module supports the use of connection=netconf
For information on using netconf see the Platform Options guide using Netconf
For more information on using Ansible to manage network devices see the Ansible Network Guide
This module is supported on
ansible_network_os
network platforms. See the Network Platform Options for details.
Examples¶
- name: use lookup filter to provide xml configuration
netconf_config:
content: "{{ lookup('file', './config.xml') }}"
- name: set ntp server in the device
netconf_config:
content: |
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
<ntp>
<enabled>true</enabled>
<server>
<name>ntp1</name>
<udp><address>127.0.0.1</address></udp>
</server>
</ntp>
</system>
</config>
- name: wipe ntp configuration
netconf_config:
content: |
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system">
<ntp>
<enabled>false</enabled>
<server operation="remove">
<name>ntp1</name>
</server>
</ntp>
</system>
</config>
- name: configure interface while providing different private key file path (for connection=netconf)
netconf_config:
backup: yes
register: backup_junos_location
vars:
ansible_private_key_file: /home/admin/.ssh/newprivatekeyfile
- name: configurable backup path
netconf_config:
backup: yes
backup_options:
filename: backup.cfg
dir_path: /home/user
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
backup_path
string
|
when backup is yes |
The full path to the backup file
Sample:
/playbooks/ansible/backup/[email protected]:28:34
|
diff
dictionary
|
when diff is enabled |
If --diff option in enabled while running, the before and after configuration change are returned as part of before and after key.
Sample:
{'after': '<rpc-reply> <data> <configuration> <version>17.3R1.10</version>...<--snip-->', 'before': '<rpc-reply> <data> <configuration> <version>17.3R1.10</version>...<--snip-->'}
|
server_capabilities
list
|
success |
list of capabilities of the server
Sample:
['urn:ietf:params:netconf:base:1.1', 'urn:ietf:params:netconf:capability:confirmed-commit:1.0', 'urn:ietf:params:netconf:capability:candidate:1.0']
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Network Team. [network]
Red Hat Support¶
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors¶
Leandro Lisboa Penz (@lpenz)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.