Skip to content

Instantly share code, notes, and snippets.

from netmiko import ConnectHandler
#### Logging
# import logging
# logging.basicConfig(filename="netmiko.log", level=logging.DEBUG)
# logger = logging.getLogger("netmiko")
#### Logging
connection = {
"device_type": "checkpoint_gaia",
@LukeDRussell
LukeDRussell / main.py
Created September 7, 2022 00:46
KMK config for FFKB
import kb
from kmk.keys import KC
from kmk.modules.combos import Combos, Sequence
from kmk.modules.dynamic_sequences import DynamicSequences
from kmk.modules.layers import Layers
from kmk.modules.oneshot import OneShot
combos = Combos()
dyn_seq = DynamicSequences(
@LukeDRussell
LukeDRussell / luke_kb.yml
Created July 8, 2022 01:09
Luke's ergogen starting point
---
units:
mx: 19
points:
rotate: -10
mirror:
ref: main_inner_top
distance: 4u
zones:
@LukeDRussell
LukeDRussell / with json_template as is
Created August 28, 2018 00:18
ansible-network.network-engine issue 139
ansible-playbook 2.6.3
config file = /Users/4032956/Documents/network-automation/ansible.cfg
configured module search path = ['/Users/4032956/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible
executable location = /Users/4032956/.pyenv/versions/network-automation/bin/ansible-playbook
python version = 3.6.6 (default, Jul 30 2018, 09:47:46) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
Using /Users/4032956/Documents/network-automation/ansible.cfg as config file
setting up inventory plugins
Parsed /Users/4032956/Documents/network-automation/inventory/network-lab.yml inventory source with yaml plugin
Loading callback plugin debug of type stdout, v2.0 from /Users/4032956/.pyenv/versions/3.6.6/envs/network-automation/lib/python3.6/site-packages/ansible/plugins/callback/debug.py
@LukeDRussell
LukeDRussell / ios_facts.py
Created January 19, 2018 21:05
Ansible 2.4 ios_facts.py that works for most IOS-XE devices as well
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
@LukeDRussell
LukeDRussell / Cisco IOS show inventory outputs
Created January 18, 2018 21:18
Cisco IOS show inventory outputs
csr1000v#show inventory
NAME: "Chassis", DESCR: "Cisco CSR1000V Chassis"
PID: CSR1000V , VID: V00 , SN: 9WNXZ5DMDO1
NAME: "module R0", DESCR: "Cisco CSR1000V Route Processor"
PID: CSR1000V , VID: V00 , SN: JAB1303001C
NAME: "module F0", DESCR: "Cisco CSR1000V Embedded Services Processor"
PID: CSR1000V , VID: , SN:
@LukeDRussell
LukeDRussell / Cisco IOS and IOS-XE `show version` sample outputs
Last active January 18, 2018 21:21
Cisco IOS and IOS-XE `show version` sample outputs
Cisco CISCO2921/K9 (revision 1.0) with 2547648K/73728K bytes of memory.
Cisco IOSv (revision 1.0) with with 472321K/50176K bytes of memory.
cisco ISR4331/K9 (1RU) processor with 7825388K/6147K bytes of memory.
cisco ISR4431/K9 (1RU) processor with 1681388K/6147K bytes of memory.
cisco CSR1000V (VXE) processor (revision VXE) with 1126522K/3075K bytes of memory.
cisco WS-C3850-48XS (MIPS) processor with 8388608K bytes of physical memory.
cisco WS-C2960X-48TD-L (APM86XXX) processor (revision M0) with 524288K bytes of memory.
[luke@cit-config-01 deployPSN]$ ./network_facts.yml -i tmy -l SwitchB -u test -k -vvvv
19920 1492747005.39305: starting run
Using /home/luke/deployPSN/ansible.cfg as config file
SSH password:
19920 1492747007.25852: Loading CacheModule 'memory' from /home/luke/ansible/lib/ansible/plugins/cache/memory.py
19920 1492747007.30163: Loading CallbackModule 'default' from /home/luke/ansible/lib/ansible/plugins/callback/default.py
Loading callback plugin default of type stdout, v2.0 from /home/luke/ansible/lib/ansible/plugins/callback/__init__.pyc
19920 1492747007.30271: Loading CallbackModule 'actionable' from /home/luke/ansible/lib/ansible/plugins/callback/actionable.py (found_in_cache=False, class_only=True)
19920 1492747007.30297: Loading CallbackModule 'context_demo' from /home/luke/ansible/lib/ansible/plugins/callback/context_demo.py (found_in_cache=False, class_only=True)
19920 1492747007.30321: Loading CallbackModule 'debug' from /home/luke/ansible/lib/ansible/plugins/callback/debug.py (found_in_cache=
@LukeDRussell
LukeDRussell / systemctl status supervisord
Last active July 14, 2016 04:32
netbox - 503 error with Centos7, Apache and gunicorn
[root@cit-netbox-01 supervisord.d]# systemctl status supervisord
● supervisord.service - Process Monitoring and Control Daemon
Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2016-07-14 22:06:45 AEST; 7s ago
Process: 3564 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=0/SUCCESS)
Main PID: 3567 (supervisord)
CGroup: /system.slice/supervisord.service
├─3567 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
├─3568 /usr/bin/python /usr/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
├─3573 /usr/bin/python /usr/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
@LukeDRussell
LukeDRussell / deploy_tunnel.yml
Created April 16, 2016 07:43
ios_template making changes when router config already exists
#!/usr/bin/env ansible-playbook
- name: Deploy DMVPN tunnels
hosts: dmvpn
gather_facts: no
connection: local
vars_files:
- vpn_vars.yml
roles:
- deploy_tunnel