Documentation

netconf_config - netconf device configuration

New in version 2.2.

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.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • ncclient

Parameters

Parameter
Choices/Defaults
Comments
allow_agent
(added in 2.4)
Default:
yes
if true, enables querying SSH agent (if found) for keys
if false, disables querying the SSH agent for ssh keys
datastore
(added in 2.4)
Default:
auto
auto, uses candidate and fallback to running
candidate, edit <candidate/> datastore and then commit
running, edit <running/> datastore directly
host
required
the hostname or ip address of the netconf device
hostkey_verify
Default:
yes
if true, the ssh host key of the device must match a ssh key present on the host
if false, the ssh host key of the device is not checked
look_for_keys
(added in 2.4)
Default:
yes
if true, enables looking in the usual locations for ssh keys (e.g. ~/.ssh/id_*)
if false, disables looking for ssh keys
password
required
password of the user to authenticate with
port
Default:
830
the netconf port
save
(added in 2.4)
Default:
no
The save argument instructs the module to save the running- config to the startup-config if changed.
src
(added in 2.4)
Specifies the source path to the xml file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with xml.
username
required
the username to authenticate with
xml
the XML content to send to the device

Notes

Note

  • This module supports devices with and without the candidate and confirmed-commit capabilities. It always use the safer feature.
  • This module supports the use of connection=netconf

Examples

- name: use lookup filter to provide xml configuration
  netconf_config:
    xml: "{{ lookup('file', './config.xml') }}"
    host: 10.0.0.1
    username: admin
    password: admin

- name: set ntp server in the device
  netconf_config:
    host: 10.0.0.1
    username: admin
    password: admin
    xml: |
        <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:
    host: 10.0.0.1
    username: admin
    password: admin
    xml: |
        <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>

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key
Returned
Description
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 flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Leandro Lisboa Penz (@lpenz)

Hint

If you notice any issues in this documentation you can edit this document to improve it.