From ef87fd8fce440384dbf44a4570ef741a30c15f8d Mon Sep 17 00:00:00 2001 From: John Poland Date: Wed, 6 Nov 2024 15:23:28 -0500 Subject: [PATCH] code commit --- code/backup_configs-cisco.retry | 2 + code/backup_configs-cisco.yml | 44 ++++++ code/backup_configs.retry | 1 + code/backup_configs.yml | 28 ++++ code/central-inventory.csv | 75 +++++++++ code/hourly-cisco.sh | 5 + code/hourly.sh | 6 + code/inv.new | 253 ++++++++++++++++++++++++++++++ code/inventory-cisco.yml | 45 ++++++ code/inventory-test.yml | 261 +++++++++++++++++++++++++++++++ code/inventory.yml | 261 +++++++++++++++++++++++++++++++ code/makeinventory.py | 36 +++++ code/run_backup_configs-cisco.sh | 10 ++ code/run_backup_configs.sh | 10 ++ code/run_git.sh | 12 ++ code/scsd_vpn.sh | 8 + 16 files changed, 1057 insertions(+) create mode 100644 code/backup_configs-cisco.retry create mode 100644 code/backup_configs-cisco.yml create mode 100755 code/backup_configs.retry create mode 100644 code/backup_configs.yml create mode 100644 code/central-inventory.csv create mode 100755 code/hourly-cisco.sh create mode 100755 code/hourly.sh create mode 100644 code/inv.new create mode 100644 code/inventory-cisco.yml create mode 100644 code/inventory-test.yml create mode 100644 code/inventory.yml create mode 100755 code/makeinventory.py create mode 100755 code/run_backup_configs-cisco.sh create mode 100755 code/run_backup_configs.sh create mode 100755 code/run_git.sh create mode 100755 code/scsd_vpn.sh diff --git a/code/backup_configs-cisco.retry b/code/backup_configs-cisco.retry new file mode 100644 index 0000000..555aeac --- /dev/null +++ b/code/backup_configs-cisco.retry @@ -0,0 +1,2 @@ +noc-n7k-a +noc-n7k-b diff --git a/code/backup_configs-cisco.yml b/code/backup_configs-cisco.yml new file mode 100644 index 0000000..6a23253 --- /dev/null +++ b/code/backup_configs-cisco.yml @@ -0,0 +1,44 @@ +- name: "Demonstrate connecting to switches" + #hosts: switches + hosts: all + gather_facts: no + + tasks: + ### + # Collect data + # + - name: Gather facts (ios) + cisco.ios.ios_facts: + gather_subset: all + when: ansible_network_os == 'cisco.ios.ios' + + - name: + ansible.builtin.file: + path: /configs/{{building_name}} + state: directory + + - name: backup (ios) + cisco.ios.ios_config: + backup: yes + backup_options: + dir_path: /configs/{{building_name}} + filename: "{{ inventory_hostname }}.cfg" + when: ansible_network_os == 'cisco.ios.ios' + + - name: show running config + cisco.nxos.nxos_command: + commands: show running-config vdc-all + register: show_run + when: ansible_network_os == 'cisco.nxos.nxos' + + - name: output + copy: + content: "{{show_run.stdout[0] | regex_replace('Time: .*',' ')}}" + dest: /configs/{{building_name}}/{{inventory_hostname}}.cfg + when: ansible_network_os == 'cisco.nxos.nxos' + + - name: Display some facts + debug: + msg: "The hostname is {{ ansible_facts }}" + tags: never + diff --git a/code/backup_configs.retry b/code/backup_configs.retry new file mode 100755 index 0000000..44c19e4 --- /dev/null +++ b/code/backup_configs.retry @@ -0,0 +1 @@ +ct-noc-a8360-5-a diff --git a/code/backup_configs.yml b/code/backup_configs.yml new file mode 100644 index 0000000..85cf49b --- /dev/null +++ b/code/backup_configs.yml @@ -0,0 +1,28 @@ +# +# docker run --rm -v .:/work -v c:\\cygwin64\\home\\johnp\\git\\scsd\\ct-noc-config-backups:/configs -it ansiblecx ansible-playbook -i inventory.scsd.yml backup_configs.yml +# +# podman run --rm -v .:/work -v ../ct-noc-config-backups:/configs -it ansiblecx ansible-playbook -i inventory.scsd.yml backup_configs.yml +# +- hosts: all + collections: + - arubanetworks.aoscx + gather_facts: False + vars: + ansible_connection: network_cli + tasks: + - name: show running config + aoscx_command: + commands: + - show run + register: show_run + + - name: + ansible.builtin.file: + path: /configs/{{building_name}} + state: directory + + - name: output + copy: + content: "{{show_run.stdout[0]}}" + dest: /configs/{{building_name}}/{{inventory_hostname}}.cfg + diff --git a/code/central-inventory.csv b/code/central-inventory.csv new file mode 100644 index 0000000..5bac505 --- /dev/null +++ b/code/central-inventory.csv @@ -0,0 +1,75 @@ +"DEVICE NAME","TYPE","CLIENTS","ALERTS","MODEL","CONFIG STATUS","LAST SEEN","USAGE","IP ADDRESS","MAC","FIRMWARE VERSION","NAE AGGREGATE STATUS","GROUP","LABELS","SITE","UPTIME","SERIAL","UPLINK PORTS","PORT UTILIZATION" +"noc-A6300-sw1","AOS-CX Stack","0","0","6300(JL659A)","Not in sync","2023-09-20 17:04:20 (UTC)","0 bps","192.168.99.6","8c:85:c1:48:bd:00","10.11.1021","","default","","01-CTN","-","49806222-fe8b-475c-96df-01d4231bb128","","0%" +"bova-idf1-a6300-sw1","AOS-CX Stack","41","0","6300(JL659A)","In sync","-","13021960 bps","192.168.41.11","a4:0e:75:b3:01:40","10.13.1010","NORMAL","6300_GUI","IDF1","41-BOV","71 Days 0 Hours 09 Minutes","4ebd8f74-4e8b-416d-8d52-dc0a206743cf","","40%" +"bova-idf2-a6300-sw1","AOS-CX Stack","23","4","6300(JL659A)","In sync","-","59606024 bps","192.168.41.21","a4:0e:75:b3:d4:c0","10.13.1010","NORMAL","6300_GUI","IDF2","41-BOV","71 Days 0 Hours 04 Minutes","5147d636-ae19-442d-90cd-89041f1832e6","","15%" +"bova-idf3-a6300-sw1","AOS-CX Stack","43","1","6300(JL659A)","In sync","-","48760920 bps","192.168.41.31","a4:0e:75:b2:ef:40","10.13.1010","NORMAL","6300_GUI","IDF3","41-BOV","71 Days 0 Hours 10 Minutes","9e6b70c0-e131-4a6e-9fef-786d086b2ae2","","48%" +"bova-idf4-a6300-sw1","AOS-CX Stack","6","1","6300(JL659A)","In sync","-","2740680 bps","192.168.41.41","a4:0e:75:b3:74:c0","10.13.1010","NORMAL","6300_GUI","IDF4","41-BOV","71 Days 0 Hours 10 Minutes","61e81ebf-c36a-4c72-b9f9-a60b08e35640","","17%" +"bova-mdf-a6300-sw1","AOS-CX Stack","19","1","6300(JL659A)","In sync","-","8440824 bps","192.168.41.5","0c:97:5f:af:71:00","10.13.1010","NORMAL","6300_GUI","MDF","41-BOV","71 Days 0 Hours 10 Minutes","70d48421-c9b8-4888-9ef4-b770a7d97ccf","","50%" +"clary-idf1-a6300-sw1","AOS-CX Stack","70","0","6300(JL659A)","In sync","-","192273240 bps","192.168.8.11","5c:a4:7d:23:7b:00","10.13.1010","NORMAL","6300_GUI","IDF1","08-CLA","34 Days 18 Hours 49 Minutes","0689dcb8-db6b-41b6-bd49-c3bd67d57ac9","","59%" +"clary-idf2-a6300-sw1","AOS-CX Stack","19","1","6300(JL659A)","In sync","-","19136064 bps","192.168.8.21","5c:a4:7d:24:c3:40","10.13.1010","NORMAL","6300_GUI","IDF2","08-CLA","34 Days 18 Hours 50 Minutes","096d98a2-a1d3-417f-b4d7-3776658f41fb","","35%" +"clary-idf3-a6300-sw1","AOS-CX Stack","22","2","6300(JL659A)","In sync","-","26068896 bps","192.168.8.31","5c:a4:7d:25:6c:40","10.13.1010","NORMAL","6300_GUI","IDF3","08-CLA","40 Days 23 Hours 17 Minutes","fa7455c1-d3c2-4899-bf5f-9399ff94ad1c","","48%" +"clary-mdf-a6300-sw1","AOS-CX Stack","43","1","6300(JL659A)","In sync","-","31040280 bps","192.168.8.5","5c:a4:7d:23:ef:80","10.13.1010","NORMAL","6300_GUI","","08-CLA","41 Days 0 Hours 38 Minutes","42d3b0cb-0336-44b3-b8b5-c3ff04e30fc7","","50%" +"hwsmi-idf1-a6300-sw1","AOS-CX Stack","77","8","6300(JL659A)","In sync","-","15793224 bps","192.168.15.11","5c:a4:7d:22:cb:40","10.13.1010","NORMAL","6300_GUI","IDF1","15-HWS","19 Days 16 Hours 31 Minutes","2ad16ee0-f5a1-460f-b223-cb8c6075d1cd","","49%" +"hwsmi-idf2-a6300-sw1","AOS-CX Stack","75","10","6300(JL659A)","In sync","-","83107440 bps","192.168.15.21","5c:a4:7d:24:40:80","10.13.1010","NORMAL","6300_GUI","IDF2","15-HWS","19 Days 18 Hours 55 Minutes","7972cb3e-1790-4f29-832d-d5a965b9d9ea","","45%" +"hwsmi-idf3-a6300-sw1","AOS-CX Stack","79","8","6300(JL659A)","In sync","-","48599424 bps","192.168.15.31","5c:a4:7d:24:12:c0","10.13.1010","NORMAL","6300_GUI","IDF3","15-HWS","19 Days 17 Hours 54 Minutes","d9061949-3fbc-4161-82df-6586824e2e2f","","49%" +"hwsmi-idf4-a6300-sw1","AOS-CX Stack","136","6","6300(JL659A)","In sync","-","505896248 bps","192.168.15.41","5c:a4:7d:22:2d:c0","10.13.1010","NORMAL","6300_GUI","IDF4","15-HWS","19 Days 19 Hours 18 Minutes","10d8e468-841f-465e-9786-06031e781ff4","","56%" +"hwsmi-mdf-a6300-sw1","AOS-CX Stack","135","21","6300(JL659A)","In sync","-","102540560 bps","192.168.15.5","5c:a4:7d:23:db:80","10.13.1010","NORMAL","6300_GUI","MDF","15-HWS","19 Days 18 Hours 41 Minutes","88918198-5434-4049-b646-a765d2589e5d","","53%" +"itc-idf1-a6300-sw1","AOS-CX Stack","92","3","6300(JL659A)","In sync","-","12141872 bps","192.168.2.11","5c:a4:7d:23:cf:80","10.13.1010","NORMAL","6300_GUI","IDF1","02-ITC","26 Days 16 Hours 55 Minutes","cc438c4a-882d-4483-8a59-3c49e128a1da","","44%" +"itc-idf2-a6300-sw1","AOS-CX Stack","124","0","6300(JL659A)","In sync","-","105734856 bps","192.168.2.21","5c:a4:7d:23:0f:00","10.13.1010","NORMAL","6300_GUI","IDF2","02-ITC","26 Days 18 Hours 18 Minutes","7f3629c2-4241-4f28-8d73-cc14407761cf","","56%" +"itc-idf3-a6300-sw1","AOS-CX Stack","67","1","6300(JL659A)","In sync","-","3957824 bps","192.168.2.31","5c:a4:7d:23:1f:40","10.13.1010","NORMAL","6300_GUI","IDF3","02-ITC","26 Days 19 Hours 01 Minutes","a565c8ee-78c8-42c2-a9de-f95f6d86771b","","50%" +"itc-mdf-a6300-sw1","AOS-CX Stack","38","2","6300(JL659A)","In sync","-","9883664 bps","192.168.2.5","5c:a4:7d:23:bf:c0","10.13.1010","NORMAL","6300_GUI","","01-CTN","26 Days 19 Hours 02 Minutes","8ac92fb1-d88b-4456-93e2-deb134fbb1f1","","41%" +"lemoy-idf1-a6300-sw1","AOS-CX Stack","16","1","6300(JL659A)","In sync","-","5447696 bps","192.168.33.11","5c:a4:7d:1b:51:c0","10.13.1010","NORMAL","6300_GUI","IDF1","33-LEM","68 Days 2 Hours 30 Minutes","56a9d38b-7714-4f5a-af18-805da6668ba5","","57%" +"lemoy-idf2-a6300-sw1","AOS-CX Stack","15","1","6300(JL659A)","In sync","-","3722160 bps","192.168.33.21","5c:a4:7d:1d:14:40","10.13.1010","NORMAL","6300_GUI","IDF2","33-LEM","68 Days 0 Hours 39 Minutes","b88563f8-2d00-4ba0-aa5f-06b6ee4ab95e","","35%" +"lemoy-idf3-a6300-sw1","AOS-CX Stack","15","1","6300(JL659A)","In sync","-","6874936 bps","192.168.33.31","5c:a4:7d:1c:4e:00","10.13.1010","NORMAL","6300_GUI","IDF3","33-LEM","68 Days 20 Hours 17 Minutes","619d267f-4d9c-48d7-bdc4-74c9eb872586","","50%" +"lemoy-mdf-a6300-sw1","AOS-CX Stack","38","1","6300(JL659A)","In sync","-","13841672 bps","192.168.33.5","5c:a4:7d:1d:01:80","10.13.1010","NORMAL","6300_GUI","MDF","33-LEM","67 Days 21 Hours 17 Minutes","221c30ed-2fcd-4cdc-a4b1-19dd0a7a2b06","","51%" +"psla-idf1-a6300-sw1","AOS-CX Stack","49","5","6300(JL659A)","In sync","-","14935872 bps","192.168.3.11","5c:a4:7d:23:cc:40","10.13.1040","NORMAL","6300_GUI","IDF1","03-FOW","6 Days 1 Hours 05 Minutes","6088613b-61a0-4b00-bc19-4359b384a41d","","46%" +"psla-idf2-a6300-sw1","AOS-CX Stack","78","4","6300(JL659A)","In sync","-","11544136 bps","192.168.3.21","5c:a4:7d:23:8d:80","10.13.1040","NORMAL","6300_GUI","IDF2","03-FOW","6 Days 2 Hours 20 Minutes","b7bd83f7-4f9d-40bd-bb47-247c4896af3d","","57%" +"psla-idf3-a6300-sw1","AOS-CX Stack","154","15","6300(JL659A)","In sync","-","77652456 bps","192.168.3.31","5c:a4:7d:22:2b:80","10.13.1040","NORMAL","6300_GUI","IDF3","03-FOW","5 Days 20 Hours 13 Minutes","d5b6e9d4-7b8b-40fc-87c7-b05ab2b48b24","","57%" +"psla-idf4-a6300-sw1","AOS-CX Stack","104","5","6300(JL659A)","In sync","-","79719888 bps","192.168.3.41","5c:a4:7d:1d:c5:80","10.13.1040","NORMAL","6300_GUI","IDF4","03-FOW","5 Days 20 Hours 47 Minutes","884417e7-9bef-4656-a4c4-01bf872092d0","","45%" +"psla-idf4-a6300-sw2","AOS-CX Stack","6","4","6300(JL659A)","In sync","-","372408 bps","192.168.3.42","5c:a4:7d:25:c8:c0","10.13.1040","NORMAL","6300_GUI","IDF4","03-FOW","5 Days 19 Hours 57 Minutes","577440c0-d416-4e79-acd1-218790985347","","74%" +"psla-idf5-a6300-sw1","AOS-CX Stack","81","10","6300(JL659A)","In sync","-","73455824 bps","192.168.3.51","5c:a4:7d:25:b8:40","10.13.1040","NORMAL","6300_GUI","IDF5","03-FOW","5 Days 17 Hours 47 Minutes","86212f61-7846-4492-9a79-83838afd5573","","56%" +"psla-idf6-a6300-sw1","AOS-CX Stack","5","1","6300(JL659A)","In sync","-","4111920 bps","192.168.3.61","5c:a4:7d:25:27:00","10.13.1040","NORMAL","6300_GUI","IDF6","03-FOW","5 Days 19 Hours 09 Minutes","3f7237c9-9a60-4cfd-856b-f42764dfc525","","17%" +"psla-mdf-a6300-sw1","AOS-CX Stack","168","43","6300(JL659A)","In sync","-","209929248 bps","192.168.3.5","5c:a4:7d:23:7e:80","10.13.1040","NORMAL","6300_GUI","MDF","03-FOW","4 Days 0 Hours 07 Minutes","0ad59e34-bf99-4174-a722-0748e6b7cc73","","48%" +"rober-idf1-a6300-sw1","AOS-CX Stack","65","0","6300(JL659A)","In sync","-","69637136 bps","192.168.42.11","4c:d5:87:2d:12:80","10.13.1010","NORMAL","6300_GUI","IDF1","42-ROB","49 Days 0 Hours 43 Minutes","0496e61a-20d9-444e-9421-f02a8ddb0f25","","53%" +"rober-mdf-a6300-sw1","AOS-CX Stack","41","2","6300(JL659A)","In sync","-","39351736 bps","192.168.42.5","5c:a4:7d:1d:d0:c0","10.13.1010","NORMAL","6300_GUI","MDF","42-ROB","53 Days 0 Hours 21 Minutes","cb76ac0d-4ac2-4abe-bc81-99e16aa2be09","","78%" +"weeks-idf1-a6300-sw1","AOS-CX Stack","185","4","6300(JL659A)","In sync","-","168818832 bps","192.168.34.11","5c:a4:7d:23:7c:80","10.13.1010","NORMAL","6300_GUI","IDF1","34-WEE","33 Days 19 Hours 19 Minutes","20ec9a3c-8d7d-46ab-8927-1cff847af912","","67%" +"weeks-mdf-a6300-sw1","AOS-CX Stack","160","7","6300(JL659A)","In sync","-","46741752 bps","192.168.34.5","5c:a4:7d:23:0f:c0","10.13.1010","NORMAL","6300_GUI","","34-WEE","33 Days 19 Hours 22 Minutes","1b08f171-40c9-464d-b6f4-d05c4a227811","","57%" +"bova-mdf-a8360-sw1","AOS-CX","2","0","8360-16Y2C switch (JL718A)","In sync","-","60684664 bps","10.41.254.253","38:10:f0:8c:e1:00","10.13.1010","NORMAL","8360_GUI","MDF","41-BOV","71 Days 0 Hours 06 Minutes","SG23KRR023","","55%" +"bova-mdf-a8360-sw2","AOS-CX","3","0","8360-16Y2C switch (JL718A)","In sync","-","25113048 bps","10.41.254.254","38:10:f0:8c:12:e0","10.13.1010","NORMAL","8360_GUI","MDF","41-BOV","71 Days 0 Hours 06 Minutes","SG23KRR01C","","44%" +"clary-mdf-a8360-sw1","AOS-CX","2","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","186168232 bps","10.8.254.253","d4:e0:53:9e:e0:40","10.13.1010","NORMAL","8360_GUI","MDF","08-CLA","41 Days 0 Hours 25 Minutes","SG37LP00MX","","55%" +"clary-mdf-a8360-sw2","AOS-CX","2","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","75677432 bps","10.8.254.254","d4:e0:53:9e:47:40","10.13.1010","NORMAL","8360_GUI","MDF","08-CLA","41 Days 0 Hours 22 Minutes","SG30LP0098","","44%" +"ct-noc-a8325-a","AOS-CX","0","0","8325-32C (JL636A)","In sync","-","5145731120 bps","192.168.101.2","bc:d7:a5:73:77:00","10.13.1010","NORMAL","Datacenter_GUI","SPINE","01-CTN","71 Days 0 Hours 14 Minutes","TW33KM302P","","50%" +"ct-noc-a8325-b","AOS-CX","0","0","8325-32C (JL636A)","In sync","-","4327992840 bps","192.168.101.3","18:7a:3b:4a:11:00","10.13.1010","NORMAL","Datacenter_GUI","SPINE","01-CTN","71 Days 0 Hours 14 Minutes","TW35KM307F","","50%" +"ct-noc-a8360-1-8","AOS-CX","0","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","0 bps","192.168.101.18","38:bd:7a:c2:c3:80","10.13.1010","NORMAL","default","","01-CTN","71 Days 0 Hours 10 Minutes","SG39LNZ071","","0%" +"ct-noc-a8360-1-a","AOS-CX","659","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","11008762656 bps","192.168.101.11","38:bd:7a:c0:3d:c0","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 10 Minutes","SG36LNZ0XG","","38%" +"ct-noc-a8360-1-b","AOS-CX","4","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","5940124192 bps","192.168.101.21","38:bd:7a:c2:eb:80","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 11 Minutes","SG39LNZ06Y","","44%" +"ct-noc-a8360-2-8","AOS-CX","0","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","0 bps","192.168.101.28","38:bd:7a:c2:4b:c0","10.13.1010","NORMAL","default","","01-CTN","71 Days 0 Hours 10 Minutes","SG39LNZ06V","","0%" +"ct-noc-a8360-2-a","AOS-CX","40","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","800446696 bps","192.168.101.12","38:bd:7a:c0:fc:80","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 07 Minutes","SG37LNZ02Y","","38%" +"ct-noc-a8360-2-b","AOS-CX","19","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","521205712 bps","192.168.101.22","38:bd:7a:c2:e3:c0","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 12 Minutes","SG39LNZ06C","","27%" +"ct-noc-a8360-3-a","AOS-CX","0","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","122668224 bps","192.168.101.13","38:bd:7a:c0:ec:00","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 08 Minutes","SG37LNZ02R","","11%" +"ct-noc-a8360-3-b","AOS-CX","0","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","78481744 bps","192.168.101.23","38:bd:7a:c2:b3:c0","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 11 Minutes","SG39LNZ070","","11%" +"ct-noc-a8360-4-a","AOS-CX","3","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","2284349648 bps","192.168.101.14","38:bd:7a:c2:d6:80","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 09 Minutes","SG39LNZ06H","","27%" +"ct-noc-a8360-4-b","AOS-CX","0","0","8360-32Y4C v2 Switch (JL717C)","In sync","-","1907112352 bps","192.168.101.24","38:bd:7a:c2:43:00","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 15 Minutes","SG39LNZ073","","22%" +"ct-noc-a8360-5-a","AOS-CX","21","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","263773488 bps","192.168.101.15","a0:a0:01:8e:be:00","10.13.1010","NORMAL","Datacenter_GUI","LEAF","01-CTN","71 Days 0 Hours 08 Minutes","SG34LP1006","","53%" +"ct-noc-a8360-5-b","AOS-CX","11","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","620531336 bps","192.168.101.25","a0:a0:01:92:2b:00","10.13.1010","NORMAL","Datacenter_GUI","LEAF","01-CTN","71 Days 0 Hours 11 Minutes","SG34LP10K4","","34%" +"ct-noc-a8360-6-a","AOS-CX","10","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","121368400 bps","192.168.101.16","14:ab:ec:e8:e7:80","10.13.1000","NORMAL","Datacenter_GUI","","01-CTN","179 Days 15 Hours 54 Minutes","SG37LP102H","","25%" +"ct-noc-a8360-6-b","AOS-CX","5","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","79056656 bps","192.168.101.26","a0:a0:01:8e:ed:00","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 14 Minutes","SG34LP1008","","13%" +"ct-noc-a8360-7-a","AOS-CX","7","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","209278288 bps","192.168.101.17","38:bd:7a:bd:36:00","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 14 Minutes","SG33LP104Y","","44%" +"ct-noc-a8360-7-b","AOS-CX","3","0","8360-48XT4C v2 Switch (JL720C)","In sync","-","85324328 bps","192.168.101.27","14:ab:ec:e8:b8:80","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 07 Minutes","SG37LP101D","","30%" +"ct-noc-ilo-a6300-a","AOS-CX","1","0","6300M 48G 4SFP56 Swch (JL663A)","In sync","-","64529696 bps","192.168.101.19","e4:de:40:ab:d3:c0","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","62 Days 23 Hours 46 Minutes","SG38LMV05R","","21%" +"ct-noc-ilo-a6300-b","AOS-CX","3","0","6300M 48G 4SFP56 Swch (JL663A)","In sync","-","65262600 bps","192.168.101.29","e4:de:40:aa:de:80","10.13.1010","NORMAL","Datacenter_GUI","","01-CTN","71 Days 0 Hours 11 Minutes","SG38LMV08Q","","9%" +"hwsmi-mdf-a8360-sw1","AOS-CX","2","1","8360-16Y2C v2 Switch (JL718C)","In sync","-","552647456 bps","10.15.254.253","d4:e0:53:9e:e0:a0","10.13.1010","NORMAL","8360_GUI","MDF","15-HWS","19 Days 19 Hours 15 Minutes","SG37LP00N0","","66%" +"hwsmi-mdf-a8360-sw2","AOS-CX","2","1","8360-16Y2C v2 Switch (JL718C)","In sync","-","48904280 bps","10.15.254.254","d4:e0:53:9e:18:e0","10.13.1010","NORMAL","8360_GUI","MDF","15-HWS","19 Days 19 Hours 20 Minutes","SG30LP008P","","50%" +"itc-mdf-a8360-sw1","AOS-CX","0","0","8360(JL718C)","In sync","-","130438472 bps","10.2.254.253","d4:e0:53:9e:57:40","10.13.1010","NORMAL","8360_GUI","MDF","02-ITC","26 Days 20 Hours 29 Minutes","SG30LP009H","","50%" +"itc-mdf-a8360-sw2","AOS-CX","2","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","48397560 bps","10.2.254.254","d4:e0:53:9e:15:80","10.13.1010","NORMAL","8360_GUI","MDF","02-ITC","26 Days 20 Hours 28 Minutes","SG37LP00NB","","38%" +"lemoy-mdf-a8360-sw1","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","29299232 bps","10.33.254.253","d4:e0:53:9e:25:20","10.13.1010","NORMAL","8360_GUI","MDF","33-LEM","68 Days 1 Hours 02 Minutes","SG37LP00NS","","44%" +"lemoy-mdf-a8360-sw2","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","612448 bps","10.33.254.254","d4:e0:53:9e:51:20","10.13.1010","NORMAL","8360_GUI","MDF","33-LEM","68 Days 0 Hours 56 Minutes","SG37LP00N6","","33%" +"psla-mdf-a8360-sw1","AOS-CX","2","1","8360-16Y2C v2 Switch (JL718C)","In sync","-","336438952 bps","10.3.254.253","d4:e0:53:9e:37:60","10.13.1010","NORMAL","8360_GUI","MDF","03-FOW","4 Days 23 Hours 08 Minutes","SG30LP009D","","83%" +"psla-mdf-a8360-sw2","AOS-CX","2","1","8360-16Y2C v2 Switch (JL718C)","In sync","-","81635328 bps","10.3.254.254","d4:e0:53:9e:15:40","10.13.1010","NORMAL","8360_GUI","MDF","03-FOW","6 Days 1 Hours 29 Minutes","SG37LP00N7","","66%" +"rober-mdf-a8360-sw1","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","94578680 bps","10.42.254.253","d4:e0:53:9e:15:20","10.13.1010","NORMAL","8360_GUI","MDF","42-ROB","53 Days 0 Hours 07 Minutes","SG37LP00N8","","33%" +"rober-mdf-a8360-sw2","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","8508416 bps","10.42.254.254","d4:e0:53:9e:18:00","10.13.1010","NORMAL","8360_GUI","MDF","42-ROB","53 Days 0 Hours 02 Minutes","SG30LP007Y","","22%" +"sh-noc-8325-a","AOS-CX","0","0","8325-32C (JL636A)","In sync","-","1696 bps","192.168.114.4","18:7a:3b:49:06:00","10.13.1010","NORMAL","Datacenter_GUI","SPINE","114-SHN","0 Days 15 Hours 56 Minutes","TW35KM303L","","6%" +"sh-noc-8325-b","AOS-CX","0","0","8325-32C (JL636A)","In sync","-","1568 bps","192.168.114.5","bc:d7:a5:73:0a:00","10.13.1010","NORMAL","Datacenter_GUI","SPINE","114-SHN","0 Days 16 Hours 36 Minutes","TW33KM303K","","6%" +"sh-noc-ilo-a6300-a","AOS-CX","0","1","6300M 48G 4SFP56 Swch (JL663A)","In sync","-","3264 bps","192.168.114.100","e4:de:40:ab:2c:40","10.13.1010","NORMAL","Datacenter_GUI","","","0 Days 0 Hours 21 Minutes","SG38LMV05V","","7%" +"weeks-mdf-a8360-sw1","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","73757584 bps","10.34.254.253","d4:e0:53:9e:25:40","10.13.1010","NORMAL","8360_GUI","MDF","34-WEE","33 Days 20 Hours 31 Minutes","SG37LP00NN","","33%" +"weeks-mdf-a8360-sw2","AOS-CX","0","0","8360-16Y2C v2 Switch (JL718C)","In sync","-","18569448 bps","10.34.254.254","d4:e0:53:9e:e7:80","10.13.1010","NORMAL","8360_GUI","MDF","34-WEE","33 Days 20 Hours 44 Minutes","SG30LP0095","","22%" diff --git a/code/hourly-cisco.sh b/code/hourly-cisco.sh new file mode 100755 index 0000000..2fa4e5e --- /dev/null +++ b/code/hourly-cisco.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +docker run --rm -e DFLT_PASSWORD=$DFLT_PASSWORD -e DFLT_USERNAME=$DFLT_USERNAME -e PASSWORD=$PASSWORD -e USERNAME=$USERNAME -v /home/johnp/scsd-configs:/repo -v /home/johnp/scsd-configs/code:/work -v /home/johnp/scsd-configs/configs/:/configs --privileged -t scsdansible ./run_backup_configs-cisco.sh + +#/home/johnp/scsd-configs/code/run_git.sh diff --git a/code/hourly.sh b/code/hourly.sh new file mode 100755 index 0000000..986b348 --- /dev/null +++ b/code/hourly.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +docker run --rm -e DFLT_PASSWORD=$DFLT_PASSWORD -e DFLT_USERNAME=$DFLT_USERNAME -e PASSWORD=$PASSWORD -e USERNAME=$USERNAME -v /home/johnp/scsd-configs:/repo -v /home/johnp/scsd-configs/code:/work -v /home/johnp/scsd-configs/configs/:/configs --privileged -t scsdansible ./run_backup_configs.sh +docker run --rm -e DFLT_PASSWORD=$DFLT_PASSWORD -e DFLT_USERNAME=$DFLT_USERNAME -e PASSWORD=$PASSWORD -e USERNAME=$USERNAME -v /home/johnp/scsd-configs:/repo -v /home/johnp/scsd-configs/code:/work -v /home/johnp/scsd-configs/configs/:/configs --privileged -t scsdansible ./run_backup_configs-cisco.sh + +/home/johnp/scsd-configs/code/run_git.sh diff --git a/code/inv.new b/code/inv.new new file mode 100644 index 0000000..936559c --- /dev/null +++ b/code/inv.new @@ -0,0 +1,253 @@ +bova: + hosts: + bova-idf1-a6300-sw1: + ansible_host: 192.168.41.11 + building_name: bova + bova-idf2-a6300-sw1: + ansible_host: 192.168.41.21 + building_name: bova + bova-idf3-a6300-sw1: + ansible_host: 192.168.41.31 + building_name: bova + bova-idf4-a6300-sw1: + ansible_host: 192.168.41.41 + building_name: bova + bova-mdf-a6300-sw1: + ansible_host: 192.168.41.5 + building_name: bova + bova-mdf-a8360-sw1: + ansible_host: 10.41.254.253 + building_name: bova + bova-mdf-a8360-sw2: + ansible_host: 10.41.254.254 + building_name: bova +clary: + hosts: + clary-idf1-a6300-sw1: + ansible_host: 192.168.8.11 + building_name: clary + clary-idf2-a6300-sw1: + ansible_host: 192.168.8.21 + building_name: clary + clary-idf3-a6300-sw1: + ansible_host: 192.168.8.31 + building_name: clary + clary-mdf-a6300-sw1: + ansible_host: 192.168.8.5 + building_name: clary + clary-mdf-a8360-sw1: + ansible_host: 10.8.254.253 + building_name: clary + clary-mdf-a8360-sw2: + ansible_host: 10.8.254.254 + building_name: clary +hwsmi: + hosts: + hwsmi-idf1-a6300-sw1: + ansible_host: 192.168.15.11 + building_name: hwsmi + hwsmi-idf2-a6300-sw1: + ansible_host: 192.168.15.21 + building_name: hwsmi + hwsmi-idf3-a6300-sw1: + ansible_host: 192.168.15.31 + building_name: hwsmi + hwsmi-idf4-a6300-sw1: + ansible_host: 192.168.15.41 + building_name: hwsmi + hwsmi-mdf-a6300-sw1: + ansible_host: 192.168.15.5 + building_name: hwsmi + hwsmi-mdf-a8360-sw1: + ansible_host: 10.15.254.253 + building_name: hwsmi + hwsmi-mdf-a8360-sw2: + ansible_host: 10.15.254.254 + building_name: hwsmi +itc: + hosts: + itc-idf1-a6300-sw1: + ansible_host: 192.168.2.11 + building_name: itc + itc-idf2-a6300-sw1: + ansible_host: 192.168.2.21 + building_name: itc + itc-idf3-a6300-sw1: + ansible_host: 192.168.2.31 + building_name: itc + itc-mdf-a6300-sw1: + ansible_host: 192.168.2.5 + building_name: itc + itc-mdf-a8360-sw1: + ansible_host: 10.2.254.253 + building_name: itc + itc-mdf-a8360-sw2: + ansible_host: 10.2.254.254 + building_name: itc +lemoy: + hosts: + lemoy-idf1-a6300-sw1: + ansible_host: 192.168.33.11 + building_name: lemoy + lemoy-idf2-a6300-sw1: + ansible_host: 192.168.33.21 + building_name: lemoy + lemoy-idf3-a6300-sw1: + ansible_host: 192.168.33.31 + building_name: lemoy + lemoy-mdf-a6300-sw1: + ansible_host: 192.168.33.5 + building_name: lemoy + lemoy-mdf-a8360-sw1: + ansible_host: 10.33.254.253 + building_name: lemoy + lemoy-mdf-a8360-sw2: + ansible_host: 10.33.254.254 + building_name: lemoy +psla: + hosts: + psla-idf1-a6300-sw1: + ansible_host: 192.168.3.11 + building_name: psla + psla-idf2-a6300-sw1: + ansible_host: 192.168.3.21 + building_name: psla + psla-idf3-a6300-sw1: + ansible_host: 192.168.3.31 + building_name: psla + psla-idf4-a6300-sw1: + ansible_host: 192.168.3.41 + building_name: psla + psla-idf4-a6300-sw2: + ansible_host: 192.168.3.42 + building_name: psla + psla-idf5-a6300-sw1: + ansible_host: 192.168.3.51 + building_name: psla + psla-idf6-a6300-sw1: + ansible_host: 192.168.3.61 + building_name: psla + psla-mdf-a6300-sw1: + ansible_host: 192.168.3.5 + building_name: psla + psla-mdf-a8360-sw1: + ansible_host: 10.3.254.253 + building_name: psla + psla-mdf-a8360-sw2: + ansible_host: 10.3.254.254 + building_name: psla +rober: + hosts: + rober-idf1-a6300-sw1: + ansible_host: 192.168.42.11 + building_name: rober + rober-mdf-a6300-sw1: + ansible_host: 192.168.42.5 + building_name: rober + rober-mdf-a8360-sw1: + ansible_host: 10.42.254.253 + building_name: rober + rober-mdf-a8360-sw2: + ansible_host: 10.42.254.254 + building_name: rober +weeks: + hosts: + weeks-idf1-a6300-sw1: + ansible_host: 192.168.34.11 + building_name: weeks + weeks-mdf-a6300-sw1: + ansible_host: 192.168.34.5 + building_name: weeks + weeks-mdf-a8360-sw1: + ansible_host: 10.34.254.253 + building_name: weeks + weeks-mdf-a8360-sw2: + ansible_host: 10.34.254.254 + building_name: weeks +6300: + hosts: + 6300: + ansible_host: 192.168.114.100 + building_name: 6300 +ct: + hosts: + ct-noc-a8325-a: + ansible_host: 192.168.101.2 + building_name: ct + ct-noc-a8325-b: + ansible_host: 192.168.101.3 + building_name: ct + ct-noc-a8360-1-8: + ansible_host: 192.168.101.18 + building_name: ct + ct-noc-a8360-1-a: + ansible_host: 192.168.101.11 + building_name: ct + ct-noc-a8360-1-b: + ansible_host: 192.168.101.21 + building_name: ct + ct-noc-a8360-2-8: + ansible_host: 192.168.101.28 + building_name: ct + ct-noc-a8360-2-a: + ansible_host: 192.168.101.12 + building_name: ct + ct-noc-a8360-2-b: + ansible_host: 192.168.101.22 + building_name: ct + ct-noc-a8360-3-a: + ansible_host: 192.168.101.13 + building_name: ct + ct-noc-a8360-3-b: + ansible_host: 192.168.101.23 + building_name: ct + ct-noc-a8360-4-a: + ansible_host: 192.168.101.14 + building_name: ct + ct-noc-a8360-4-b: + ansible_host: 192.168.101.24 + building_name: ct + ct-noc-a8360-5-a: + ansible_host: 192.168.101.15 + building_name: ct + ct-noc-a8360-5-b: + ansible_host: 192.168.101.25 + building_name: ct + ct-noc-a8360-6-a: + ansible_host: 192.168.101.16 + building_name: ct + ct-noc-a8360-6-b: + ansible_host: 192.168.101.26 + building_name: ct + ct-noc-a8360-7-a: + ansible_host: 192.168.101.17 + building_name: ct + ct-noc-a8360-7-b: + ansible_host: 192.168.101.27 + building_name: ct + ct-noc-ilo-a6300-a: + ansible_host: 192.168.101.19 + building_name: ct + ct-noc-ilo-a6300-b: + ansible_host: 192.168.101.29 + building_name: ct +sh: + hosts: + sh-noc-8325-a: + ansible_host: 192.168.114.4 + building_name: sh + sh-noc-8325-b: + ansible_host: 192.168.114.5 + building_name: sh + +all: + vars: + ansible_user: jpoland.oa + ansible_password: "Rew181^^" + ansible_network_os: arubanetworks.aoscx.aoscx + ansible_connection: arubanetworks.aoscx.aoscx # REST API via pyaoscx connection method + ansible_aoscx_validate_certs: False + ansible_aoscx_use_proxy: False + ansible_acx_no_proxy: True + ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + diff --git a/code/inventory-cisco.yml b/code/inventory-cisco.yml new file mode 100644 index 0000000..6055a45 --- /dev/null +++ b/code/inventory-cisco.yml @@ -0,0 +1,45 @@ +blodgett: + hosts: + blodgett-mdf-4507: + ansible_host: 192.168.53.1 + building_name: blodgett +porter: + hosts: + porter-4507-1: + ansible_host: 192.168.40.1 + building_name: porter +grant: + hosts: + grant-4507-1: + ansible_host: 192.168.9.1 + building_name: grant +shea: + hosts: + shea-4507-1: + ansible_host: 192.168.14.1 + building_name: shea +frazer: + hosts: + frazer-mdf-4507: + ansible_host: 192.168.25.1 + building_name: frazer +ssc: + hosts: + ssc-mdf-4507: + ansible_host: 192.168.56.1 + building_name: ssc +ct: + hosts: + noc-n7k-a: + ansible_host: 192.168.1.2 + ansible_network_os: cisco.nxos.nxos + building_name: ct + noc-n7k-b: + ansible_host: 192.168.1.3 + ansible_network_os: cisco.nxos.nxos + building_name: ct +all: + vars: + ansible_connection: ansible.netcommon.network_cli + ansible_network_os: cisco.ios.ios + ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" diff --git a/code/inventory-test.yml b/code/inventory-test.yml new file mode 100644 index 0000000..78219b1 --- /dev/null +++ b/code/inventory-test.yml @@ -0,0 +1,261 @@ +bova: + hosts: + bova-idf1-a6300-sw1: + ansible_host: 192.168.41.11 + building_name: bova + bova-idf2-a6300-sw1: + ansible_host: 192.168.41.21 + building_name: bova + bova-idf3-a6300-sw1: + ansible_host: 192.168.41.31 + building_name: bova + bova-idf4-a6300-sw1: + ansible_host: 192.168.41.41 + building_name: bova + bova-mdf-a6300-sw1: + ansible_host: 192.168.41.5 + building_name: bova + bova-mdf-a8360-sw1: + ansible_host: 10.41.254.253 + building_name: bova + bova-mdf-a8360-sw2: + ansible_host: 10.41.254.254 + building_name: bova +clary: + hosts: + clary-idf1-a6300-sw1: + ansible_host: 192.168.8.11 + building_name: clary + clary-idf2-a6300-sw1: + ansible_host: 192.168.8.21 + building_name: clary + clary-idf3-a6300-sw1: + ansible_host: 192.168.8.31 + building_name: clary + clary-mdf-a6300-sw1: + ansible_host: 192.168.8.5 + building_name: clary + clary-mdf-a8360-sw1: + ansible_host: 10.8.254.253 + building_name: clary + clary-mdf-a8360-sw2: + ansible_host: 10.8.254.254 + building_name: clary +hwsmi: + hosts: + hwsmi-idf1-a6300-sw1: + ansible_host: 192.168.15.11 + building_name: hwsmi + hwsmi-idf2-a6300-sw1: + ansible_host: 192.168.15.21 + building_name: hwsmi + hwsmi-idf3-a6300-sw1: + ansible_host: 192.168.15.31 + building_name: hwsmi + hwsmi-idf4-a6300-sw1: + ansible_host: 192.168.15.41 + building_name: hwsmi + hwsmi-mdf-a6300-sw1: + ansible_host: 192.168.15.5 + building_name: hwsmi + hwsmi-mdf-a8360-sw1: + ansible_host: 10.15.254.253 + building_name: hwsmi + hwsmi-mdf-a8360-sw2: + ansible_host: 10.15.254.254 + building_name: hwsmi +itc: + hosts: + itc-idf1-a6300-sw1: + ansible_host: 192.168.2.11 + building_name: itc + itc-idf2-a6300-sw1: + ansible_host: 192.168.2.21 + building_name: itc + itc-idf3-a6300-sw1: + ansible_host: 192.168.2.31 + building_name: itc + itc-mdf-a6300-sw1: + ansible_host: 192.168.2.5 + building_name: itc + itc-mdf-a8360-sw1: + ansible_host: 10.2.254.253 + building_name: itc + itc-mdf-a8360-sw2: + ansible_host: 10.2.254.254 + building_name: itc +lemoy: + hosts: + lemoy-idf1-a6300-sw1: + ansible_host: 192.168.33.11 + building_name: lemoy + lemoy-idf2-a6300-sw1: + ansible_host: 192.168.33.21 + building_name: lemoy + lemoy-idf3-a6300-sw1: + ansible_host: 192.168.33.31 + building_name: lemoy + lemoy-mdf-a6300-sw1: + ansible_host: 192.168.33.5 + building_name: lemoy + lemoy-mdf-a8360-sw1: + ansible_host: 10.33.254.253 + building_name: lemoy + lemoy-mdf-a8360-sw2: + ansible_host: 10.33.254.254 + building_name: lemoy +psla: + hosts: + psla-idf1-a6300-sw1: + ansible_host: 192.168.3.11 + building_name: psla + psla-idf2-a6300-sw1: + ansible_host: 192.168.3.21 + building_name: psla + psla-idf3-a6300-sw1: + ansible_host: 192.168.3.31 + building_name: psla + psla-idf4-a6300-sw1: + ansible_host: 192.168.3.41 + building_name: psla + psla-idf4-a6300-sw2: + ansible_host: 192.168.3.42 + building_name: psla + psla-idf5-a6300-sw1: + ansible_host: 192.168.3.51 + building_name: psla + psla-idf6-a6300-sw1: + ansible_host: 192.168.3.61 + building_name: psla + psla-mdf-a6300-sw1: + ansible_host: 192.168.3.5 + building_name: psla + psla-mdf-a8360-sw1: + ansible_host: 10.3.254.253 + building_name: psla + psla-mdf-a8360-sw2: + ansible_host: 10.3.254.254 + building_name: psla +rober: + hosts: + rober-idf1-a6300-sw1: + ansible_host: 192.168.42.11 + building_name: rober + rober-mdf-a6300-sw1: + ansible_host: 192.168.42.5 + building_name: rober + rober-mdf-a8360-sw1: + ansible_host: 10.42.254.253 + building_name: rober + rober-mdf-a8360-sw2: + ansible_host: 10.42.254.254 + building_name: rober +weeks: + hosts: + weeks-idf1-a6300-sw1: + ansible_host: 192.168.34.11 + building_name: weeks + weeks-mdf-a6300-sw1: + ansible_host: 192.168.34.5 + building_name: weeks + weeks-mdf-a8360-sw1: + ansible_host: 10.34.254.253 + building_name: weeks + weeks-mdf-a8360-sw2: + ansible_host: 10.34.254.254 + building_name: weeks +ct: + hosts: + ct-noc-a8325-a: + ansible_host: 192.168.101.2 + building_name: ct + ct-noc-a8325-b: + ansible_host: 192.168.101.3 + building_name: ct + ct-noc-a8360-1-8: + ansible_host: 192.168.101.18 + building_name: ct + ct-noc-a8360-1-a: + ansible_host: 192.168.101.11 + building_name: ct + ct-noc-a8360-1-b: + ansible_host: 192.168.101.21 + building_name: ct + ct-noc-a8360-2-8: + ansible_host: 192.168.101.28 + building_name: ct + ct-noc-a8360-2-a: + ansible_host: 192.168.101.12 + building_name: ct + ct-noc-a8360-2-b: + ansible_host: 192.168.101.22 + building_name: ct + ct-noc-a8360-3-a: + ansible_host: 192.168.101.13 + building_name: ct + ct-noc-a8360-3-b: + ansible_host: 192.168.101.23 + building_name: ct + ct-noc-a8360-4-a: + ansible_host: 192.168.101.14 + building_name: ct + ct-noc-a8360-4-b: + ansible_host: 192.168.101.24 + building_name: ct + ct-noc-a8360-5-a: + ansible_host: 192.168.101.15 + building_name: ct + ct-noc-a8360-5-b: + ansible_host: 192.168.101.25 + building_name: ct + ct-noc-a8360-6-a: + ansible_host: 192.168.101.16 + building_name: ct + ct-noc-a8360-6-b: + ansible_host: 192.168.101.26 + building_name: ct + ct-noc-a8360-7-a: + ansible_host: 192.168.101.17 + building_name: ct + ct-noc-a8360-7-b: + ansible_host: 192.168.101.27 + building_name: ct + ct-noc-ilo-a6300-a: + ansible_host: 192.168.101.19 + building_name: ct + ct-noc-ilo-a6300-b: + ansible_host: 192.168.101.29 + building_name: ct +sh: + hosts: + sh-noc-a8325-a: + ansible_host: 192.168.114.4 + building_name: sh + sh-noc-a8325-b: + ansible_host: 192.168.114.5 + building_name: sh + sh-noc-a8360-1-a: + ansible_host: 192.168.114.11 + building_name: sh + sh-noc-a8360-1-b: + ansible_host: 192.168.114.21 + building_name: sh + sh-noc-a8360-5-a: + ansible_host: 192.168.114.15 + building_name: sh + sh-noc-a8360-5-b: + ansible_host: 192.168.114.25 + building_name: sh + sh-noc-ilo-a6300-a: + ansible_host: 192.168.114.19 + building_name: sh + +all: + vars: + ansible_network_os: arubanetworks.aoscx.aoscx + ansible_connection: arubanetworks.aoscx.aoscx # REST API via pyaoscx connection method + ansible_aoscx_validate_certs: False + ansible_aoscx_use_proxy: False + ansible_acx_no_proxy: True + ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + diff --git a/code/inventory.yml b/code/inventory.yml new file mode 100644 index 0000000..2a8e135 --- /dev/null +++ b/code/inventory.yml @@ -0,0 +1,261 @@ +bova: + hosts: + bova-idf1-a6300-sw1: + ansible_host: 192.168.41.11 + building_name: bova + bova-idf2-a6300-sw1: + ansible_host: 192.168.41.21 + building_name: bova + bova-idf3-a6300-sw1: + ansible_host: 192.168.41.31 + building_name: bova + bova-idf4-a6300-sw1: + ansible_host: 192.168.41.41 + building_name: bova + bova-mdf-a6300-sw1: + ansible_host: 192.168.41.5 + building_name: bova + bova-mdf-a8360-sw1: + ansible_host: 10.41.254.253 + building_name: bova + bova-mdf-a8360-sw2: + ansible_host: 10.41.254.254 + building_name: bova +clary: + hosts: + clary-idf1-a6300-sw1: + ansible_host: 192.168.8.11 + building_name: clary + clary-idf2-a6300-sw1: + ansible_host: 192.168.8.21 + building_name: clary + clary-idf3-a6300-sw1: + ansible_host: 192.168.8.31 + building_name: clary + clary-mdf-a6300-sw1: + ansible_host: 192.168.8.5 + building_name: clary + clary-mdf-a8360-sw1: + ansible_host: 10.8.254.253 + building_name: clary + clary-mdf-a8360-sw2: + ansible_host: 10.8.254.254 + building_name: clary +hwsmi: + hosts: + hwsmi-idf1-a6300-sw1: + ansible_host: 192.168.15.11 + building_name: hwsmi + hwsmi-idf2-a6300-sw1: + ansible_host: 192.168.15.21 + building_name: hwsmi + hwsmi-idf3-a6300-sw1: + ansible_host: 192.168.15.31 + building_name: hwsmi + hwsmi-idf4-a6300-sw1: + ansible_host: 192.168.15.41 + building_name: hwsmi + hwsmi-mdf-a6300-sw1: + ansible_host: 192.168.15.5 + building_name: hwsmi + hwsmi-mdf-a8360-sw1: + ansible_host: 10.15.254.253 + building_name: hwsmi + hwsmi-mdf-a8360-sw2: + ansible_host: 10.15.254.254 + building_name: hwsmi +itc: + hosts: + itc-idf1-a6300-sw1: + ansible_host: 192.168.2.11 + building_name: itc + itc-idf2-a6300-sw1: + ansible_host: 192.168.2.21 + building_name: itc + itc-idf3-a6300-sw1: + ansible_host: 192.168.2.31 + building_name: itc + itc-mdf-a6300-sw1: + ansible_host: 192.168.2.5 + building_name: itc + itc-mdf-a8360-sw1: + ansible_host: 10.2.254.253 + building_name: itc + itc-mdf-a8360-sw2: + ansible_host: 10.2.254.254 + building_name: itc +lemoy: + hosts: + lemoy-idf1-a6300-sw1: + ansible_host: 192.168.33.11 + building_name: lemoy + lemoy-idf2-a6300-sw1: + ansible_host: 192.168.33.21 + building_name: lemoy + lemoy-idf3-a6300-sw1: + ansible_host: 192.168.33.31 + building_name: lemoy + lemoy-mdf-a6300-sw1: + ansible_host: 192.168.33.5 + building_name: lemoy + lemoy-mdf-a8360-sw1: + ansible_host: 10.33.254.253 + building_name: lemoy + lemoy-mdf-a8360-sw2: + ansible_host: 10.33.254.254 + building_name: lemoy +psla: + hosts: + psla-idf1-a6300-sw1: + ansible_host: 192.168.3.11 + building_name: psla + psla-idf2-a6300-sw1: + ansible_host: 192.168.3.21 + building_name: psla + psla-idf3-a6300-sw1: + ansible_host: 192.168.3.31 + building_name: psla + psla-idf4-a6300-sw1: + ansible_host: 192.168.3.41 + building_name: psla + psla-idf4-a6300-sw2: + ansible_host: 192.168.3.42 + building_name: psla + psla-idf5-a6300-sw1: + ansible_host: 192.168.3.51 + building_name: psla + psla-idf6-a6300-sw1: + ansible_host: 192.168.3.61 + building_name: psla + psla-mdf-a6300-sw1: + ansible_host: 192.168.3.5 + building_name: psla + psla-mdf-a8360-sw1: + ansible_host: 10.3.254.253 + building_name: psla + psla-mdf-a8360-sw2: + ansible_host: 10.3.254.254 + building_name: psla +rober: + hosts: + rober-idf1-a6300-sw1: + ansible_host: 192.168.42.11 + building_name: rober + rober-mdf-a6300-sw1: + ansible_host: 192.168.42.5 + building_name: rober + rober-mdf-a8360-sw1: + ansible_host: 10.42.254.253 + building_name: rober + rober-mdf-a8360-sw2: + ansible_host: 10.42.254.254 + building_name: rober +weeks: + hosts: + weeks-idf1-a6300-sw1: + ansible_host: 192.168.34.11 + building_name: weeks + weeks-mdf-a6300-sw1: + ansible_host: 192.168.34.5 + building_name: weeks + weeks-mdf-a8360-sw1: + ansible_host: 10.34.254.253 + building_name: weeks + weeks-mdf-a8360-sw2: + ansible_host: 10.34.254.254 + building_name: weeks +ct: + hosts: + ct-noc-a8325-a: + ansible_host: 192.168.101.2 + building_name: ct + ct-noc-a8325-b: + ansible_host: 192.168.101.3 + building_name: ct + ct-noc-a8360-8-a: + ansible_host: 192.168.101.18 + building_name: ct + ct-noc-a8360-1-a: + ansible_host: 192.168.101.11 + building_name: ct + ct-noc-a8360-1-b: + ansible_host: 192.168.101.21 + building_name: ct + ct-noc-a8360-8-b: + ansible_host: 192.168.101.28 + building_name: ct + ct-noc-a8360-2-a: + ansible_host: 192.168.101.12 + building_name: ct + ct-noc-a8360-2-b: + ansible_host: 192.168.101.22 + building_name: ct + ct-noc-a8360-3-a: + ansible_host: 192.168.101.13 + building_name: ct + ct-noc-a8360-3-b: + ansible_host: 192.168.101.23 + building_name: ct + ct-noc-a8360-4-a: + ansible_host: 192.168.101.14 + building_name: ct + ct-noc-a8360-4-b: + ansible_host: 192.168.101.24 + building_name: ct + ct-noc-a8360-5-a: + ansible_host: 192.168.101.15 + building_name: ct + ct-noc-a8360-5-b: + ansible_host: 192.168.101.25 + building_name: ct + ct-noc-a8360-6-a: + ansible_host: 192.168.101.16 + building_name: ct + ct-noc-a8360-6-b: + ansible_host: 192.168.101.26 + building_name: ct + ct-noc-a8360-7-a: + ansible_host: 192.168.101.17 + building_name: ct + ct-noc-a8360-7-b: + ansible_host: 192.168.101.27 + building_name: ct + ct-noc-ilo-a6300-a: + ansible_host: 192.168.101.19 + building_name: ct + ct-noc-ilo-a6300-b: + ansible_host: 192.168.101.29 + building_name: ct +sh: + hosts: + sh-noc-a8325-a: + ansible_host: 192.168.114.4 + building_name: sh + sh-noc-a8325-b: + ansible_host: 192.168.114.5 + building_name: sh + sh-noc-a8360-1-a: + ansible_host: 192.168.114.11 + building_name: sh + sh-noc-a8360-1-b: + ansible_host: 192.168.114.21 + building_name: sh + sh-noc-a8360-5-a: + ansible_host: 192.168.114.15 + building_name: sh + sh-noc-a8360-5-b: + ansible_host: 192.168.114.25 + building_name: sh + sh-noc-ilo-a6300-a: + ansible_host: 192.168.114.19 + building_name: sh + +all: + vars: + ansible_network_os: arubanetworks.aoscx.aoscx + ansible_connection: arubanetworks.aoscx.aoscx # REST API via pyaoscx connection method + ansible_aoscx_validate_certs: False + ansible_aoscx_use_proxy: False + ansible_acx_no_proxy: True + ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + diff --git a/code/makeinventory.py b/code/makeinventory.py new file mode 100755 index 0000000..be1ac74 --- /dev/null +++ b/code/makeinventory.py @@ -0,0 +1,36 @@ +import csv + +all_vars=""" +all: + vars: + ansible_network_os: arubanetworks.aoscx.aoscx + ansible_connection: arubanetworks.aoscx.aoscx # REST API via pyaoscx connection method + ansible_aoscx_validate_certs: False + ansible_aoscx_use_proxy: False + ansible_acx_no_proxy: True + ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" +""" + +building_dict={} + +with open('central-inventory.csv') as csv_file: + csv_reader = csv.DictReader(csv_file) + for row in csv_reader: + device_name=row["DEVICE NAME"] + ip_address=row['IP ADDRESS'] + config_status=row['CONFIG STATUS'] + if config_status=='In sync': + building=device_name.split("-")[0] + if building not in building_dict: + building_dict[building]=[] + building_dict[building].append((device_name,ip_address)) + +#print(building_dict) +for building in building_dict: + print(f"{building}:") + print(f" hosts:") + for device_name,ip_address in building_dict[building]: + print(f" {device_name}:") + print(f" ansible_host: {ip_address}") + print(f" building_name: {building}") +print(all_vars) diff --git a/code/run_backup_configs-cisco.sh b/code/run_backup_configs-cisco.sh new file mode 100755 index 0000000..381edb6 --- /dev/null +++ b/code/run_backup_configs-cisco.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert ac3383137ff2554a78858b218ec3126bf7a779db83d4e7ba4affc9d8827fa69f --password=$PASSWORD & +while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ]; +do + #echo checking + sleep 1 +done +ansible-playbook -e "ansible_user=$USERNAME ansible_password=$PASSWORD" -i inventory-cisco.yml backup_configs-cisco.yml +#ansible-playbook -e "ansible_user=$DFLT_USERNAME ansible_password=$DFLT_PASSWORD" -i inventory.yml -l @backup_configs.retry backup_configs.yml +chown -R 1000:1000 /configs/ diff --git a/code/run_backup_configs.sh b/code/run_backup_configs.sh new file mode 100755 index 0000000..51ec5c9 --- /dev/null +++ b/code/run_backup_configs.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert ac3383137ff2554a78858b218ec3126bf7a779db83d4e7ba4affc9d8827fa69f --password=$PASSWORD & +while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ]; +do + #echo checking + sleep 1 +done +ansible-playbook -e "ansible_user=$USERNAME ansible_password=$PASSWORD" -i inventory.yml backup_configs.yml +ansible-playbook -e "ansible_user=$DFLT_USERNAME ansible_password=$DFLT_PASSWORD" -i inventory.yml -l @backup_configs.retry backup_configs.yml +chown -R 1000:1000 /configs/ diff --git a/code/run_git.sh b/code/run_git.sh new file mode 100755 index 0000000..dbd120a --- /dev/null +++ b/code/run_git.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +datestamp=`date` + +cd /home/johnp/scsd-configs/configs +for f in `find . -type f -name "*.cfg" | sed 's:./::' ` +do + echo $f + git add $f + git commit -m "$f $datestamp" +done + diff --git a/code/scsd_vpn.sh b/code/scsd_vpn.sh new file mode 100755 index 0000000..d0d2f7b --- /dev/null +++ b/code/scsd_vpn.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash +openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert ac3383137ff2554a78858b218ec3126bf7a779db83d4e7ba4affc9d8827fa69f --password=$PASSWORD & +while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ]; +do + #echo checking + sleep 1 +done +bash