junipernetworks / junipernetworks.junos / 8.0.0 / module / junos_rpc Runs an arbitrary RPC over NetConf on an Juniper JUNOS device | "added in version" 1.0.0 of junipernetworks.junos" Authors: Peter Sprygada (@privateip)junipernetworks.junos.junos_rpc (8.0.0) — module
Install with ansible-galaxy collection install junipernetworks.junos:==8.0.0
collections: - name: junipernetworks.junos version: 8.0.0
Sends a request to the remote device running JUNOS to execute the specified RPC using the NetConf transport. The reply is then returned to the playbook in the C(xml) key. If an alternate output format is requested, the reply is transformed to the requested output.
- name: collect interface information using rpc junipernetworks.junos.junos_rpc: rpc: get-interface-information args: interface-name: em0 media: true
- name: get system information junipernetworks.junos.junos_rpc: rpc: get-system-information
- name: load configuration junipernetworks.junos.junos_rpc: rpc: load-configuration attrs: action: override url: /tmp/config.conf
rpc: description: - The C(rpc) argument specifies the RPC call to send to the remote devices to be executed. The RPC Reply message is parsed and the contents are returned to the playbook. required: true type: str args: description: - The C(args) argument provides a set of arguments for the RPC call and are encoded in the request message. This argument accepts a set of key=value arguments. type: dict attrs: description: - The C(attrs) arguments defines a list of attributes and their values to set for the RPC call. This accepts a dictionary of key-values. type: dict output: choices: - xml - json - text default: xml description: - The C(output) argument specifies the desired output of the return data. This argument accepts one of C(xml), C(text), or C(json). For C(json), the JUNOS device must be running a version of software that supports native JSON output. type: str
output: description: The rpc rely converted to the output format. returned: always type: str output_lines: description: The text output split into lines for readability. returned: always type: list xml: description: The xml return string from the rpc request. returned: always type: str