Hi Folks, I am trying to display output for junos command “show
configuration | compare rollback 1” through ansible however every time I
store the data, I see the whole config output. Any ideas?
Is there another way to get the previously commited data using rollbacks? I
am using the new role "junipernetworks.junos.junos" so im not find a way to
come up with a way for this. Previous role junos_config had a way but
modules have now changed.
*Playbook*
---
- name: Playbook to check last commit
hosts: net-junos
connection: netconf
gather_facts: no
roles:
- junipernetworks.junos
tasks:
- name: Check last commit config
junipernetworks.junos.junos_command:
commands: "show configuration | compare rollback 1"
register: result
- name: Display Output
debug:
var: result.stdout_lines
*Output*
[junos]$ ansible-playbook -i inventory/lab/hosts.ini
19_show_compare_rollback.yml
PLAY [Playbook to configure IP Fabric]
*****************************************************************
TASK [Check last commit config]
************************************************************************
ok: [fw-1]
TASK [Display Output]
**********************************************************************************
ok: [fw-1] => {
"result.stdout_lines": [
[
"## Last changed: 2020-10-15 16:12:14 UTC",
"version 20190606.224121_builder.r1033375;",
"system {",
" host-name net-junos;",
" root-authentication {",
" encrypted-password \"redacted";",
" }",
" login {",
......... (redacted)
"routing-instances {",
" test {",
" instance-type virtual-router;",
" routing-options {",
" graceful-restart;",
" }",
" interface reth2.10;",
" interface reth2.20;",
" }",
"}"
]
]
}
PLAY RECAP
*********************************************************************************************
net-junos : ok=2 changed=0 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ead6dced-03d7-4d21-82dd-70916d5b6017n%40googlegroups.com.