ansible.builtin.restconf_config (v2.9.27) — module

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

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

Authors: Ganesh Nalawade (@ganeshrn)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.27

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
  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

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.

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

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

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