Note
This plugin is part of the ansible.netcommon collection (version 1.5.0).
To install it use: ansible-galaxy collection install ansible.netcommon
.
To use it in a playbook, specify: ansible.netcommon.netconf_rpc
.
New in version 1.0.0: of ansible.netcommon
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
content string | This argument specifies the optional request content (all RPC attributes). The content value can either be provided as XML formatted string or as dictionary. | |
display string |
| Encoding scheme to use when serializing output from the device. The option json will serialize the output as JSON data. If the option value is json it requires jxmlease to be installed on control node. The option pretty is similar to received XML response but is using human readable format (spaces, new lines). The option value xml is similar to received XML response but removes all XML namespaces. |
rpc string / required | This argument specifies the request (name of the operation) to be executed on the remote NETCONF enabled device. | |
xmlns string | NETCONF operations not defined in rfc6241 typically require the appropriate XML namespace to be set. In the case the request option is not already provided in XML format, the namespace can be defined by the xmlns option. |
Note
get-config
, get
or edit-config
requests it is recommended to use the Ansible netconf_get and netconf_config modules.ansible_network_os
network platforms. See the Network Platform Options for details.- name: lock candidate ansible.netcommon.netconf_rpc: rpc: lock content: target: candidate: - name: unlock candidate ansible.netcommon.netconf_rpc: rpc: unlock xmlns: urn:ietf:params:xml:ns:netconf:base:1.0 content: "{'target': {'candidate': None}}" - name: discard changes ansible.netcommon.netconf_rpc: rpc: discard-changes - name: get-schema ansible.netcommon.netconf_rpc: rpc: get-schema xmlns: urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring content: identifier: ietf-netconf version: '2011-06-01' - name: copy running to startup ansible.netcommon.netconf_rpc: rpc: copy-config content: source: running: target: startup: - name: get schema list with JSON output ansible.netcommon.netconf_rpc: rpc: get content: | <filter> <netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"> <schemas/> </netconf-state> </filter> display: json - name: get schema using XML request ansible.netcommon.netconf_rpc: rpc: get-schema xmlns: urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring content: | <identifier>ietf-netconf-monitoring</identifier> <version>2010-10-04</version> display: json
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |
---|---|---|---|
output complex | when the display format is selected as JSON it is returned as dict type, if the display format is xml or pretty pretty it is returned as a string apart from low-level errors (such as action plugin). | Based on the value of display option will return either the set of transformed XML to JSON format from the RPC response with type dict or pretty XML string response (human-readable) or response with namespace removed from XML string. | |
formatted_output string | success | Contains formatted response received from remote host as per the value in display format. | |
stdout string | always apart from low-level errors (such as action plugin) | The raw XML string containing configuration or state data received from the underlying ncclient library. Sample: ... | |
stdout_lines list / elements=string | always apart from low-level errors (such as action plugin) | The value of stdout split into a list Sample: ['...', '...'] |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ansible/netcommon/netconf_rpc_module.html