ansible.builtin.netconf_config (v2.5.15) — module

netconf device configuration

| "added in version" 2.2 of ansible.builtin"

Authors: Leandro Lisboa Penz (@lpenz)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.15

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: use lookup filter to provide xml configuration
  netconf_config:
    xml: "{{ lookup('file', './config.xml') }}"
    host: 10.0.0.1
    username: admin
    password: admin
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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>
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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>

Inputs

    
src:
    description:
    - 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 I(xml).
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

xml:
    description:
    - the XML content to send to the device
    required: false

host:
    description:
    - the hostname or ip address of the netconf device
    required: true

port:
    default: 830
    description:
    - the netconf port
    required: false

save:
    default: false
    description:
    - The C(save) argument instructs the module to save the running- config to the startup-config
      if changed.
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

password:
    description:
    - password of the user to authenticate with
    required: true

username:
    description:
    - the username to authenticate with
    required: true

datastore:
    default: auto
    description:
    - auto, uses candidate and fallback to running
    - candidate, edit <candidate/> datastore and then commit
    - running, edit <running/> datastore directly
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

allow_agent:
    default: true
    description:
    - if true, enables querying SSH agent (if found) for keys
    - if false, disables querying the SSH agent for ssh keys
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

look_for_keys:
    default: true
    description:
    - if true, enables looking in the usual locations for ssh keys (e.g. ~/.ssh/id_*)
    - if false, disables looking for ssh keys
    required: false
    version_added: '2.4'
    version_added_collection: ansible.builtin

hostkey_verify:
    default: true
    description:
    - 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
    required: false

Outputs

server_capabilities:
  description: list of capabilities of the server
  returned: success
  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
  type: list