Skip to content

Instantly share code, notes, and snippets.

View hpreston's full-sized avatar

Hank Preston hpreston

View GitHub Profile
@hpreston
hpreston / socket_path_error.txt
Created April 12, 2018 21:32
Ansible 2.5 Connection Error
ansible-playbook 2.5.0
config file = /Users/hapresto/coding/netdevops_demos/ansible_02/ansible.cfg
configured module search path = ['/Users/hapresto/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/hapresto/coding/netdevops_demos/ansible_02/v2_5/lib/python3.6/site-packages/ansible
executable location = /Users/hapresto/coding/netdevops_demos/ansible_02/v2_5/bin/ansible-playbook
python version = 3.6.5 (default, Apr 1 2018, 09:50:04) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
Using /Users/hapresto/coding/netdevops_demos/ansible_02/ansible.cfg as config file
setting up inventory plugins
Parsed /Users/hapresto/coding/netdevops_demos/ansible_02/default_inventory.yaml inventory source with yaml plugin
Loading callback plugin default of type stdout, v2.0 from /Users/hapresto/coding/netdevops_demos/ansible_02/v2_5/lib/python3.6/site-packages/ansible/plugins/callback/default.py
@hpreston
hpreston / wildcard.py
Last active November 13, 2019 22:13
Create Wildcard Mask
# Simple function to create a wildcard mask from a subnet mask
def wildcard_mask(netmask):
# Ensure netmask provided is a basic string (ie not an IPv4Address)
netmask = str(netmask)
# Break into a list of octets as integers
netmask_list = map(int, netmask.split("."))
# Use XOR to "invert" each octect
wildcard_list = [ 255^octet for octet in netmask_list ]
# Join wildcard octets into a single wildcard mask string
@hpreston
hpreston / ansible_config.yaml
Created April 25, 2020 16:32
Example Ansible IOS Config
# command to run ansible-playbook -i inventory.yml ansible_config.yaml
---
- hosts: sandbox-iosxe-latest
gather_facts: false
connection: network_cli
tasks:
- name: facts
ios_facts:
gather_subset: all