ansible.netcommon.restconf_config (6.1.0) — module

Handles create, update, read and delete of configuration data on RESTCONF enabled devices.

| "added in version" 1.0.0 of ansible.netcommon"

Authors: Ganesh Nalawade (@ganeshrn)

Install collection

Install with ansible-galaxy collection install ansible.netcommon:==6.1.0


Add to requirements.yml

  collections:
    - name: ansible.netcommon
      version: 6.1.0

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
                        }
                      ]
       }

Inputs

    
path:
    description:
    - URI being used to execute API calls.
    required: true
    type: str

format:
    choices:
    - json
    - xml
    default: json
    description:
    - 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.
    type: str

method:
    choices:
    - post
    - put
    - patch
    - delete
    default: post
    description:
    - 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.
    required: false
    type: str

content:
    description:
    - The configuration data in format as specififed in C(format) option. Required unless
      C(method) is I(delete).
    type: str

Outputs

candidate:
  description: The configuration sent to the device.
  returned: When the method is not delete
  sample: "{\n    \"vpn-service\": [\n        {\n            \"customer-name\": \"\
    red\",\n            \"vpn-id\": \"blue_vpn1\",\n            \"vpn-service-topology\"\
    : \"ietf-l3vpn-svc:any-to-any\"\n        }\n    ]\n}\n"
  type: dict
running:
  description: The current running configuration on the device.
  returned: When the method is not delete
  sample: "{\n    \"vpn-service\": [\n        {\n          \"vpn-id\": \"red_vpn2\"\
    ,\n          \"customer-name\": \"blue\",\n          \"vpn-service-topology\"\
    : \"ietf-l3vpn-svc:any-to-any\"\n        },\n        {\n          \"vpn-id\":\
    \ \"blue_vpn1\",\n          \"customer-name\": \"red\",\n          \"vpn-service-topology\"\
    : \"ietf-l3vpn-svc:any-to-any\"\n        }\n    ]\n}\n"
  type: dict