ansible.netcommon.restconf_get – Fetch configuration/state data from RESTCONF enabled devices.

Note

This plugin is part of the ansible.netcommon collection (version 2.5.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.restconf_get.

New in version 1.0.0: of ansible.netcommon

Synopsis

  • RESTCONF is a standard mechanisms to allow web applications to access the configuration data and state data developed and standardized by the IETF. It is documented in RFC 8040.

  • This module allows the user to fetch configuration and state data from RESTCONF enabled devices.

Parameters

Parameter

Comments

content

string

The content is a query parameter that controls how descendant nodes of the requested data nodes in path will be processed in the reply. If value is config return only configuration descendant data nodes of value in path. If value is nonconfig return only non-configuration descendant data nodes of value in path. If value is all return all descendant data nodes of value in path

Choices:

  • config

  • nonconfig

  • all

output

string

The output of response received.

Choices:

  • json ← (default)

  • xml

path

string / 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 ansible_connection value of ansible.netcommon.httpapi and ansible_network_os value of ansible.netcommon.restconf.

  • This module is tested against Cisco IOSXE 16.12.02 version.

Examples

- name: get l3vpn services
  ansible.netcommon.restconf_get:
    path: /config/ietf-l3vpn-svc:l3vpn-svc/vpn-services

Return Values

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

Key

Description

response

dictionary

A dictionary representing a JSON-formatted response

Returned: when the device response is valid JSON

Sample: “{\n \”vpn-services\”: {\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}\n”

Authors

  • Ganesh Nalawade (@ganeshrn)