Skip to content

Instantly share code, notes, and snippets.

@benagricola
Last active July 3, 2017 15:39
Show Gist options
  • Save benagricola/f3a094625ae4d41f6517016def6c9edd to your computer and use it in GitHub Desktop.
Save benagricola/f3a094625ae4d41f6517016def6c9edd to your computer and use it in GitHub Desktop.
junos_command module does not return parsed XML object
- name: Get BGP Neighbor Info
hosts: all
gather_facts: False
connection: local
tasks:
- name: Get BGP Peers
junos_command:
rpcs:
- "get-bgp-summary-information"
display: xml
provider:
username: '{{ user }}'
host: '{{ inventory_hostname }}'
port: 22
register: result
- name: print data
debug: var=result
ba@* ~/d/network_deploy> ansible-playbook plays/adhoc/get_bgp.yml -i 'bdr1.mgt,'
PLAY [Load Facts] **************************************************************************************************************************************************************************************************************************
TASK [Get BGP Peers] ***********************************************************************************************************************************************************************************************************************
ok: [bdr1.mgt]
TASK [print data] **************************************************************************************************************************************************************************************************************************
ok: [bdr1.mgt] => {
"result": {
"changed": false,
"stdout": [
"<rpc-reply message-id=\"urn:uuid:c9328c8e-93c2-428e-8aab-a850a97c416b\">\n<bgp-information>\n<group-count>13</group-count>\n<peer-count>25</peer-count>\n<down-peer-count>0</down-peer-count>\n... TRUNCATED ...</bgp-information>\n</rpc-reply>"
],
"stdout_lines": [
[
"<rpc-reply message-id=\"urn:uuid:c9328c8e-93c2-428e-8aab-a850a97c416b\">",
"<bgp-information>",
"<group-count>13</group-count>",
"<peer-count>25</peer-count>",
"<down-peer-count>0</down-peer-count>",
... TRUNCATED ...
"</bgp-information>",
"</rpc-reply>"
]
]
}
}
PLAY RECAP *********************************************************************************************************************************************************************************************************************************
bdr1.mgt : ok=2 changed=0 unreachable=0 failed=0
ba@* ~/d/network_deploy> ansible-playbook plays/adhoc/get_bgp.yml -i 'bdr1.mgt,'
PLAY [Load Facts] **************************************************************************************************************************************************************************************************************************
TASK [Get BGP Peers] ***********************************************************************************************************************************************************************************************************************
ok: [bdr1.mgt]
TASK [print data] **************************************************************************************************************************************************************************************************************************
ok: [bdr1.mgt] => {
"result": {
"changed": false,
"output": [
{
"rpc-reply": {
"bgp-information": {
"bgp-peer": [
... TRUNCATED ...
],
"down-peer-count": "0",
"group-count": "13",
"peer-count": "25"
}
}
}
],
"stdout": [
"<rpc-reply message-id=\"urn:uuid:d974310f-4515-4aac-96c9-f8d76098f487\">\n<bgp-information>\n<group-count>13</group-count>\n<peer-count>25</peer-count>\n<down-peer-count>0</down-peer-count>\n... TRUNCATED ...</bgp-information>\n</rpc-reply>"
],
"stdout_lines": [
[
"<rpc-reply message-id=\"urn:uuid:d974310f-4515-4aac-96c9-f8d76098f487\">",
"<bgp-information>",
"<group-count>13</group-count>",
"<peer-count>25</peer-count>",
"<down-peer-count>0</down-peer-count>",
... TRUNCATED ...
"</bgp-information>",
"</rpc-reply>"
]
]
}
}
PLAY RECAP *********************************************************************************************************************************************************************************************************************************
bdr1.mgt : ok=2 changed=0 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment