Skip to content

Instantly share code, notes, and snippets.

View wdennis's full-sized avatar

Will Dennis wdennis

View GitHub Profile
---
- name: Fail if OS is not Ubuntu
fail:
msg: "This role only supports Ubuntu Linux currently."
when: (ansible_distribution != "Ubuntu")
- name: Run Ubuntu 16.04 tasks
include_tasks: Ubuntu-16.04.yml
when: (ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04")

Nornir class attributes

Given that nr is result of InitNornir()... (i.e., nr = InitNornir())

nr: Attributes for class nornir.core.Nornir:

  • close_connections - method -
  • config - class nornir.core.configuration.Config
  • data - class nornir.core.state.GlobalState - placeholder to share data amongst different versions of Nornir after running "filter" multiple times.
  • dict - method - Returns a dictionary representing the object, with 'data' and 'inventory' keys and their corresponding values.
@wdennis
wdennis / create_servers.yml
Created October 6, 2017 16:25
Ansible Packet playbook
- name: create Packet server(s)
hosts: localhost
tasks:
- packet_sshkey:
key_file: ~/.ssh/id_rsa.pub
label: packet-specific key
- packet_device:
@wdennis
wdennis / gist:b38c9dcc7e196d3122f2
Created July 13, 2015 16:42
basic-boxstarter-config-script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
Install-WindowsUpdate -AcceptEula
@wdennis
wdennis / gist:a59d967ad4b86f9dd152
Created January 19, 2015 01:15
Cisco switch "last running cfg change" SNMP counter anomaly
(py2venv)[19:57 wdennis@laptop Unit_1] > ./snmp_last_cfg_save_analysis.py
System has been up for 72491.45 seconds
Last running config change was at 72460.02 seconds since boot.
Last running config save was at 72488.15 seconds since boot.
Last startup config change was at 72488.15 seconds since boot.
Startup config in sync with Running config.
...rebooted switch, and when it came up, ran my program again...
*** note: did not make any cfg change, or even log in ***
@wdennis
wdennis / lab-2511-sh-run.txt
Created February 4, 2014 21:10
Lab 2511 sh run
lab-console:18#sh run
Building configuration...
Current configuration:
!
version 11.2
service password-encryption
no service udp-small-servers
no service tcp-small-servers
!