Skip to content

Instantly share code, notes, and snippets.

View IPvSean's full-sized avatar

Sean Cavanaugh IPvSean

View GitHub Profile
[student1@ansible ~]$ cat ~/networking-workshop/lab_inventory/hosts
[all:vars]
ansible_port=22
[routers:children]
cisco
juniper
[routers:vars]
ansible_ssh_private_key_file=/home/student1/.ssh/aws-private.pem
{
"name": "Simple Survey",
"description": "Description of the simple survey",
"spec": [
{
"type": "multiplechoice",
"question_name": "example question",
"question_description": "Rollback to which date?",
"variable": "rollback_date",
"choices": [
@IPvSean
IPvSean / output.txt
Created January 3, 2019 15:12
output from tower
Identity added: /tmp/awx_204_NHjMgN/credential_2 (/tmp/awx_204_NHjMgN/credential_2)
PLAY [BACKUP ROUTER CONFIGURATIONS] ********************************************
TASK [LOAD L3 INTERFACE] *******************************************************
@IPvSean
IPvSean / example inventory
Created February 5, 2019 21:34
example ansible network automation inventory
[leafs]
leaf01 ansible_host=10.16.10.11
leaf02 ansible_host=10.16.10.12
[spines]
spine01 ansible_host=10.16.10.13
spine02 ansible_host=10.16.10.14
[network:children]
leafs
@IPvSean
IPvSean / currentway.yml
Created February 19, 2019 19:38
old authentication method vs httpapi connection plugin
---
- name: GRAB F5 FACTS
hosts: f5
connection: local
gather_facts: no
tasks:
- name: COLLECT BIG-IP FACTS
bigip_facts:
@IPvSean
IPvSean / example spin up vsrx
Created February 27, 2019 21:07
this gist is just quick and dirty spin up vrx
---
- name: AWS PLAYBOOK 101
connection: local
hosts: localhost
gather_facts: false
# The paramater region will be set for all ec2 modules by specifying it here under module_defaults
module_defaults:
group/aws:
region: us-west-2
vars:
@IPvSean
IPvSean / tower standup
Created March 7, 2019 15:35
this simple playbook stands up tower to be able to create workshops for anyone
- name: TOWER CONFIGURATION IN PLAYBOOK FORM
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: CREATE INVENTORY
tower_inventory:
name: "LINKLIGHT_TEST_INVENTORY"
organization: Default
tower_config_file: "~/tower_cli.cfg"
@IPvSean
IPvSean / example.yml
Created July 26, 2019 23:40
ansible example with juniper junos using cli_command
[student1@ansible networking-workshop]$ cat junos_example.yml
---
- name: gather information from routers
hosts: juniper
gather_facts: no
tasks:
- name: gather router facts
vars:
@IPvSean
IPvSean / adhoc.yml
Created August 5, 2019 22:46
adhoc example with cli_command on cisco ios-xe device
[student1@ansible ~]$ ansible -m cli_command -a "command='show ip int br'" rtr3
rtr3 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"stdout": "Interface IP-Address OK? Method Status Protocol\nGigabitEthernet1 172.16.168.217 YES DHCP up up \nLoopback0 192.168.3.103 YES manual up up \nLoopback1 10.3.3.103 YES manual up up \nTunnel0 10.100.100.2 YES manual up up \nVirtualPortGroup0 192.168.35.101 YES TFTP up up",
"stdout_lines": [
"Interface IP-Address OK? Method Status Protocol",
"GigabitEthernet1 172.16.168.217 YES DHCP up up ",
@IPvSean
IPvSean / events_table.csv
Last active November 25, 2019 18:21
events_table.csv example of running one job template
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 15 columns, instead of 3. in line 5.
id,created,uuid,parent_uuid,event,task_action,failed,changed,playbook,play,task,role,job_id,host_id,host_name
882497,2019-11-25 18:02:23.08498+00,14b9eac4-56db-4991-8b43-b35332659195,"",playbook_on_start,,f,f,azure_facts_demo.yaml,"","","",36019,,""
882498,2019-11-25 18:02:23.139071+00,0ad19a72-8eec-3dc1-41eb-000000000006,14b9eac4-56db-4991-8b43-b35332659195,playbook_on_play_start,,f,f,azure_facts_demo.yaml,HELLO WORLD FOR AZURE,"","",36019,,""
882499,2019-11-25 18:02:23.163426+00,0ad19a72-8eec-3dc1-41eb-000000000008,0ad19a72-8eec-3dc1-41eb-000000000006,playbook_on_task_start,"""azure_rm_resource_facts""",f,f,azure_facts_demo.yaml,HELLO WORLD FOR AZURE,GATHER FACTS FOR THE AZURE RESOURCE GROUP,"",36019,,""
882500,2019-11-25 18:02:23.164897+00,1d8bba0d-a1bc-4772-b3f6-501453a9560f,0ad19a72-8eec-3dc1-41eb-000000000008,runner_on_start,"""azure_rm_resource_facts""",f,f,azure_facts_demo.yaml,HELLO WORLD FOR AZURE,GATHER FACTS FOR THE AZURE RESOURCE GROUP,"",36019,8367,localhost
882501,2019-11-25 18:02:23.164122+00,