Skip to content

Instantly share code, notes, and snippets.

View trishnaguha's full-sized avatar
🎯

Trishna Guha trishnaguha

🎯
View GitHub Profile
@trishnaguha
trishnaguha / demo.yml
Created February 5, 2019 12:24
Ansible101
- hosts: webserver
connection: local
tasks:
- shell: /bin/echo hello
- ping:
@trishnaguha
trishnaguha / demo.yml
Created February 5, 2019 12:17
Ansible 101
- hosts: webserver
connection: local
tasks:
- shell: /bin/echo hello
@trishnaguha
trishnaguha / command_parser export
Created January 10, 2019 08:56
command_parser export
- name: match sections
pattern_match:
regex: "^(\\S+) is up,"
match_all: true
match_greedy: true
export: yes
register: section
- name: match interface values
pattern_group:
@trishnaguha
trishnaguha / command_parser
Last active January 10, 2019 08:55
command_parser
- name: match sections
pattern_match:
regex: "^(\\S+) is up,"
match_all: true
match_greedy: true
register: section
- name: match interface values
pattern_group:
- name: match name
- name: Parser for VRF output
parser_metadata:
version: 1.0
command: show vrf
network_os: ios
- name: Match VRF output
pattern_match:
regex: "^\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s*(\\S*)$"
match_all: yes
@trishnaguha
trishnaguha / nxos_system sanity network_cli test log
Created July 4, 2018 10:26
nxos_system sanity network_cli test log
TASK [nxos_system : debug] *****************************************************
ok: [a43a2620-674e-491d-928b-25be8f6f8587] => {
"msg": "START connection=network_cli/sanity.yaml"
}
TASK [nxos_system : debug] *****************************************************
skipping: [a43a2620-674e-491d-928b-25be8f6f8587] => {}
TASK [nxos_system : remove configuration] **************************************
changed: [a43a2620-674e-491d-928b-25be8f6f8587] => {"changed": true, "commands": ["no hostname", "no ip name-server 10.0.2.3"]}
"stdout": [
{
"TABLE_snapshot": {
"ROW_snapshot": [
{
"file_name": "interface.xml",
"snap_name": "test_snapshot1"
},
{
"file_name": "route-summary.xml",
@trishnaguha
trishnaguha / nxos_run_commands_check_rc_false
Created May 24, 2018 12:54
nxos_run_commands_check_rc_false
$ git show bdd77747506ca2ba3697fb80884e0826889a5819
commit bdd77747506ca2ba3697fb80884e0826889a5819 (HEAD -> nxos_run_commands_check_rc_false)
Author: Trishna Guha <trishnaguha17@gmail.com>
Date: Thu May 24 16:31:51 2018 +0530
fix nxos run_commands with check_rc being False
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
diff --git a/lib/ansible/module_utils/network/nxos/nxos.py b/lib/ansible/module_utils/network/nxos/nxos.py
@trishnaguha
trishnaguha / nxos_install_os connection network_cli
Created May 17, 2018 16:22
nxos_install_os connection network_cli
TASK [nxos_install_os] ******************************************************************************************************************************************************
task path: /home/tguha/RHWork/ansible/hacking/example/nxosinstall.yml:9
<nxos3k> attempting to start connection
<nxos3k> using connection plugin network_cli
<nxos3k> local domain socket does not exist, starting it
<nxos3k> control socket path is /home/tguha/.ansible/pc/c5f1dec22f
<nxos3k> <nxos3k> ESTABLISH CONNECTION FOR USER: admin on PORT 22 TO nxos3k
<nxos3k> <nxos3k> ssh connection done, setting terminal
<nxos3k> <nxos3k> loaded terminal plugin for network_os nxos
<nxos3k> <nxos3k> loaded cliconf plugin for network_os nxos
@trishnaguha
trishnaguha / nxos_install_os upgrade playbook
Last active May 17, 2018 16:06
nxos_install_os upgrade playbook
ansible.cfg:
[defaults]
host_key_checking=false
inventory=inventory
[persistent_connection]
command_timeout=600
connect_timeout=600