Skip to content

Instantly share code, notes, and snippets.

View rohitthakur2590's full-sized avatar

Rohit Thakur rohitthakur2590

View GitHub Profile
- name: Parse the commands for provided configuration
vyos.vyos.vyos_ospfv2:
running_config:
"set protocols ospf area 2 area-type 'normal'
set protocols ospf area 2 authentication 'plaintext-password'
set protocols ospf area 2 shortcut 'enable'
set protocols ospf area 3 area-type 'nssa'
set protocols ospf area 4 area-type stub default-cost '20'
set protocols ospf area 4 network '192.0.2.0/24'
set protocols ospf area 4 range 192.0.3.0/24 cost '10'
@rohitthakur2590
rohitthakur2590 / gathered.txt
Created August 17, 2020 08:43
VyOS Device running config
vyos@vyos:~$ show configuration commands | grep ospf
set protocols ospf area 2 area-type 'normal'
set protocols ospf area 2 authentication 'plaintext-password'
set protocols ospf area 2 shortcut 'enable'
set protocols ospf area 4 area-type stub default-cost '20'
set protocols ospf area 4 network '192.0.2.0/24'
set protocols ospf area 4 range 192.0.3.0/24 cost '10'
set protocols ospf area 4 range 192.0.4.0/24 cost '12'
set protocols ospf auto-cost reference-bandwidth '2'
set protocols ospf default-information originate 'always'
@rohitthakur2590
rohitthakur2590 / gathered_output.txt
Created August 17, 2020 08:56
VyOS running_config_to_structured_data
$ cat nw_inventory/host_vars/vyos/ospfv2.yaml
ospfv2:
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '4'
area_type:
@rohitthakur2590
rohitthakur2590 / merged_playbook_config.txt
Last active August 17, 2020 09:55
Configuration to be merged to running-config
log_adjacency_changes: 'detail'
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
@rohitthakur2590
rohitthakur2590 / replaced_playbook_config.txt
Created August 17, 2020 10:27
input config structure for replaced state
log_adjacency_changes: 'detail'
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
@rohitthakur2590
rohitthakur2590 / config_to_be_rendered.txt
Created August 17, 2020 11:11
structured config to be rendered
log_adjacency_changes: 'detail'
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
2020-12-15 15:22:05,591 p=51362 u=rothakur n=ansible | 51362 1608025925.59060: starting run
2020-12-15 15:22:05,734 p=51362 u=rothakur n=ansible | [WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly changing source of code and can
become unstable at any point.
2020-12-15 15:22:05,736 p=51362 u=rothakur n=ansible | ansible-playbook 2.10.0.dev0
config file = /home/rothakur/ansible-collections/collections/ansible_collections/playbooks/collections/community/yang/ansible.cfg
configured module search path = ['/home/rothakur/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/rothakur/ansible-collections/collections/ansible_collections/ansible-base/lib/ansible
executable location = /home/rothakur/ansible-collections/collections/ansible_collections/ansible-base/bin/ansible-playbook
python version = 3.7.9
ANSIBLE CONFIG FILE (ansible.cfg)
[defaults]
timeout = 30
INVENTORY=./inventory
collections_paths = /home/rothakur/ansible-collections/collections
[persistent_connection]
command_timeout = 100
fatal: [localhost]: FAILED! => {
"changed": true,
"cmd": "telnet localhost 8888",
"delta": "0:15:00.204780",
"end": "2021-03-04 13:10:42.948346",
"invocation": {
"module_args": {
"chdir": null,
"command": "telnet localhost 8888",
"creates": null,
@rohitthakur2590
rohitthakur2590 / Bootstrap VM error
Created March 10, 2021 15:16
Bootstrap VM error
TASK [network-image-builder : Bootstrap VM] **************************************************************************************************************************************************************************************************
task path: /home/rothakur/ansible-collections/collections/ansible_collections/ansible-network/network-image-builder/tasks/vsrx/20.4R1/bootstrap.yaml:2
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: rothakur
<127.0.0.1> EXEC /bin/sh -c 'echo ~rothakur && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/rothakur/.ansible/tmp `"&& mkdir "` echo /home/rothakur/.ansible/tmp/ansible-tmp-1615369536.2901797-171648-244106351339516 `" && echo ansible-tmp-1615369536.2901797-171648-244106351339516="` echo /home/rothakur/.ansible/tmp/ansible-tmp-1615369536.2901797-171648-244106351339516 `" ) && sleep 0'
Using module file /home/rothakur/.local/lib/python3.9/site-packages/ansible/modules/expect.py
<127.0.0.1> PUT /home/rothakur/.ansible/tmp/ansible-local-171332q