Skip to content

restconf_config

Collection Note

This module is part of the ansible.netcommon collection. To install the collection, use:

ansible-galaxy collection install ansible.netcommon
Added in version 1.0.0.

Synopsis

  • RESTCONF is a standard mechanisms to allow web applications to configure and manage data. RESTCONF is a IETF standard and documented on RFC 8040.
  • This module allows the user to configure data on RESTCONF enabled devices.

Parameters

Parameter Defaults / Choices Comments
content
str
The configuration data in format as specififed in C(format) option. Required unless C(method) is I(delete).
format
str
Default: json
Choices: json, xml
The format of the configuration provided as value of C(content). Accepted values are I(xml) and I(json) and the given configuration format should be supported by remote RESTCONF server.
method
str
Default: post
Choices: post, put, patch, delete
The RESTCONF method to manage the configuration change on device. The value I(post) is used to create a data resource or invoke an operation resource, I(put) is used to replace the target data resource, I(patch) is used to modify the target resource, and I(delete) is used to delete the target resource.
path
str
required
URI being used to execute API calls.

Notes

Note

  • This module requires the RESTCONF system service be enabled on the remote device being managed.
  • This module is supported with I(ansible_connection) value of I(ansible.netcommon.httpapi) and I(ansible_network_os) value of I(ansible.netcommon.restconf).
  • This module is tested against Cisco IOSXE 16.12.02 version.

Examples

- name: create l3vpn services
  ansible.netcommon.restconf_config:
    path: /config/ietf-l3vpn-svc:l3vpn-svc/vpn-services
    content: |
      {
        "vpn-service":[
                        {
                          "vpn-id": "red_vpn2",
                          "customer-name": "blue",
                          "vpn-service-topology": "ietf-l3vpn-svc:any-to-any"
                        },
                        {
                          "vpn-id": "blue_vpn1",
                          "customer-name": "red",
                          "vpn-service-topology": "ietf-l3vpn-svc:any-to-any"
                        }
                      ]
       }

Return Values

Key Data Type Description Returned
candidate dict The configuration sent to the device. When the method is not delete
running dict The current running configuration on the device. When the method is not delete

Authors

  • Ganesh Nalawade (@ganeshrn)