update code directory
This commit is contained in:
parent
b7eef5f6f8
commit
146ebef285
50
code/backup_wlcs.py
Normal file
50
code/backup_wlcs.py
Normal file
@ -0,0 +1,50 @@
|
||||
import pexpect
|
||||
import argparse
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
def backup_wlc(ip, username, password,filename):
|
||||
print(f"Backing up WLC {ip}")
|
||||
print(f"Logging in with {username} and {password}")
|
||||
child = pexpect.spawn(f"ssh -oHostKeyAlgorithms=+ssh-ed25519 {username}@{ip}")
|
||||
child.expect("password:")
|
||||
child.sendline(password)
|
||||
child.expect("#")
|
||||
prompt = child.before.lstrip().decode("utf-8") + "#"
|
||||
prompt = prompt.replace("(","\(")
|
||||
prompt = prompt.replace(")","\)")
|
||||
prompt = prompt.replace("*","\*")
|
||||
prompt = prompt.replace("[","\[")
|
||||
prompt = prompt.replace("]","\]")
|
||||
child.sendline("no paging")
|
||||
child.expect(prompt)
|
||||
child.sendline("show running")
|
||||
child.expect(prompt)
|
||||
#print(child.before)
|
||||
running_config=child.before.decode("utf-8")
|
||||
running_config = running_config.replace("\r\n","\n")
|
||||
|
||||
# Write to a temporary file
|
||||
with tempfile.NamedTemporaryFile(delete=False, mode="w",
|
||||
encoding="utf-8",dir=os.path.dirname(filename)) as temp_file:
|
||||
temp_file.write(running_config)
|
||||
temp_file_path = temp_file.name
|
||||
|
||||
# Rename the temporary file to the desired output file
|
||||
try:
|
||||
os.rename(temp_file_path, filename)
|
||||
print(f"Backup saved to {filename}")
|
||||
except Exception as e:
|
||||
print(f"Failed to save backup: {e}")
|
||||
os.remove(temp_file_path) # Clean up the temporary file
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="backup aruba wlc")
|
||||
parser.add_argument("--username", help="Username for login", required=True)
|
||||
parser.add_argument("--password", help="Password for login", required=True)
|
||||
parser.add_argument("--ip", help="IP address of WLC", required=True)
|
||||
parser.add_argument("--filename", help="filename to save file", required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
backup_wlc(args.ip, args.username, args.password,args.filename)
|
||||
@ -1,11 +1,14 @@
|
||||
import centralauth
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
|
||||
DEBUG = False
|
||||
|
||||
centralauth_db=centralauth.get_centralauth()
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
all_text="""
|
||||
all:
|
||||
vars:
|
||||
@ -41,6 +44,9 @@ while True:
|
||||
if j['count']==0:
|
||||
break
|
||||
|
||||
if DEBUG:
|
||||
print(json.dumps(j,indent=2))
|
||||
|
||||
for switch in j['switches']:
|
||||
if not switch['status'] == 'Down' and not switch['ip_address']=='':
|
||||
switch_dict[switch['name']]=switch
|
||||
|
||||
@ -4,7 +4,7 @@ import json
|
||||
|
||||
|
||||
def load_kvstore():
|
||||
con = sqlite3.connect("centralauth.db")
|
||||
con = sqlite3.connect("/home/johnp/scsd-configs/git/code/centralauth.db")
|
||||
cur = con.cursor()
|
||||
res=cur.execute("select key,value from kvstore")
|
||||
data=res.fetchall()
|
||||
@ -16,7 +16,7 @@ def load_kvstore():
|
||||
|
||||
|
||||
def save_kvstore(kvstore):
|
||||
con = sqlite3.connect("centralauth.db")
|
||||
con = sqlite3.connect("/home/johnp/scsd-configs/git/code/centralauth.db")
|
||||
cur = con.cursor()
|
||||
for key in kvstore:
|
||||
sql=f"INSERT INTO kvstore (key,value) values('{key}','{kvstore[key]}') ON CONFLICT DO update set value=excluded.value"
|
||||
@ -78,6 +78,8 @@ def refresh_access_token(kvstore):
|
||||
ses = requests.Session()
|
||||
response=ses.post(url,headers=headers)
|
||||
response_data=json.loads(response.text)
|
||||
if response.status_code == 400 and ("error_description" in response_data and response_data["error_description"]=="Invalid refresh_token"):
|
||||
return(get_new_access_token(kvstore))
|
||||
kvstore['refresh_token']=response_data['refresh_token']
|
||||
kvstore['access_token']=response_data['access_token']
|
||||
save_kvstore(kvstore)
|
||||
|
||||
378
code/centralinv.yml
Normal file
378
code/centralinv.yml
Normal file
@ -0,0 +1,378 @@
|
||||
bova:
|
||||
hosts:
|
||||
bova-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.41.11
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06M
|
||||
bova-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.41.21
|
||||
building_name: bova
|
||||
serial_num: SG31KMY063
|
||||
bova-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.41.31
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06C
|
||||
bova-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.41.41
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06Q
|
||||
bova-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.41.5
|
||||
building_name: bova
|
||||
serial_num: SG29KMY1MH
|
||||
bova-mdf-a8360-sw1:
|
||||
ansible_host: 10.41.254.253
|
||||
building_name: bova
|
||||
serial_num: SG23KRR023
|
||||
bova-mdf-a8360-sw2:
|
||||
ansible_host: 10.41.254.254
|
||||
building_name: bova
|
||||
serial_num: SG23KRR01C
|
||||
bright:
|
||||
hosts:
|
||||
bright-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.46.5
|
||||
building_name: bright
|
||||
serial_num: SG43KMY029
|
||||
bright-mdf-a8360-sw1:
|
||||
ansible_host: 192.168.46.1
|
||||
building_name: bright
|
||||
serial_num: SG3AL5K03S
|
||||
clary:
|
||||
hosts:
|
||||
clary-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.8.11
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY23T
|
||||
clary-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.8.21
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY1ZR
|
||||
clary-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.8.31
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY257
|
||||
clary-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.8.5
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY24Z
|
||||
clary-mdf-a8360-sw1:
|
||||
ansible_host: 10.8.254.253
|
||||
building_name: clary
|
||||
serial_num: SG37LP00MX
|
||||
clary-mdf-a8360-sw2:
|
||||
ansible_host: 10.8.254.254
|
||||
building_name: clary
|
||||
serial_num: SG30LP0098
|
||||
ct:
|
||||
hosts:
|
||||
ct-noc-a8325-a:
|
||||
ansible_host: 192.168.101.2
|
||||
building_name: ct
|
||||
serial_num: TW33KM302P
|
||||
ct-noc-a8325-b:
|
||||
ansible_host: 192.168.101.3
|
||||
building_name: ct
|
||||
serial_num: TW35KM307F
|
||||
ct-noc-a8360-1-a:
|
||||
ansible_host: 10.251.1.253
|
||||
building_name: ct
|
||||
serial_num: SG36LNZ0XG
|
||||
ct-noc-a8360-1-b:
|
||||
ansible_host: 10.251.1.254
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06Y
|
||||
ct-noc-a8360-2-a:
|
||||
ansible_host: 192.168.101.12
|
||||
building_name: ct
|
||||
serial_num: SG37LNZ02Y
|
||||
ct-noc-a8360-2-b:
|
||||
ansible_host: 192.168.101.22
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06C
|
||||
ct-noc-a8360-3-a:
|
||||
ansible_host: 192.168.101.13
|
||||
building_name: ct
|
||||
serial_num: SG37LNZ02R
|
||||
ct-noc-a8360-3-b:
|
||||
ansible_host: 192.168.101.23
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ070
|
||||
ct-noc-a8360-4-a:
|
||||
ansible_host: 192.168.101.14
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06H
|
||||
ct-noc-a8360-4-b:
|
||||
ansible_host: 192.168.101.24
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ073
|
||||
ct-noc-a8360-5-a:
|
||||
ansible_host: 192.168.101.15
|
||||
building_name: ct
|
||||
serial_num: SG34LP1006
|
||||
ct-noc-a8360-5-b:
|
||||
ansible_host: 192.168.101.25
|
||||
building_name: ct
|
||||
serial_num: SG34LP10K4
|
||||
ct-noc-a8360-6-a:
|
||||
ansible_host: 192.168.101.16
|
||||
building_name: ct
|
||||
serial_num: SG37LP102H
|
||||
ct-noc-a8360-6-b:
|
||||
ansible_host: 192.168.101.26
|
||||
building_name: ct
|
||||
serial_num: SG34LP1008
|
||||
ct-noc-a8360-7-a:
|
||||
ansible_host: 192.168.101.17
|
||||
building_name: ct
|
||||
serial_num: SG33LP104Y
|
||||
ct-noc-a8360-7-b:
|
||||
ansible_host: 192.168.101.27
|
||||
building_name: ct
|
||||
serial_num: SG37LP101D
|
||||
ct-noc-a8360-8-a:
|
||||
ansible_host: 192.168.101.18
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ071
|
||||
ct-noc-a8360-8-b:
|
||||
ansible_host: 192.168.101.28
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06V
|
||||
ct-noc-ilo-a6300-a:
|
||||
ansible_host: 192.168.101.19
|
||||
building_name: ct
|
||||
serial_num: SG38LMV05R
|
||||
ct-noc-ilo-a6300-b:
|
||||
ansible_host: 192.168.101.29
|
||||
building_name: ct
|
||||
serial_num: SG38LMV08Q
|
||||
hwsmi:
|
||||
hosts:
|
||||
hwsmi-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.15.11
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY2JF
|
||||
hwsmi-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.15.21
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY24T
|
||||
hwsmi-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.15.31
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY22T
|
||||
hwsmi-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.15.41
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY2JC
|
||||
hwsmi-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.15.5
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY22Z
|
||||
hwsmi-mdf-a8360-sw1:
|
||||
ansible_host: 10.15.254.253
|
||||
building_name: hwsmi
|
||||
serial_num: SG37LP00N0
|
||||
hwsmi-mdf-a8360-sw2:
|
||||
ansible_host: 10.15.254.254
|
||||
building_name: hwsmi
|
||||
serial_num: SG30LP008P
|
||||
itc:
|
||||
hosts:
|
||||
itc-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.2.11
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY244
|
||||
itc-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.2.21
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY247
|
||||
itc-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.2.31
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY250
|
||||
itc-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.2.5
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY248
|
||||
itc-mdf-a8360-sw1:
|
||||
ansible_host: 10.2.254.253
|
||||
building_name: itc
|
||||
serial_num: SG30LP009H
|
||||
itc-mdf-a8360-sw2:
|
||||
ansible_host: 10.2.254.254
|
||||
building_name: itc
|
||||
serial_num: SG37LP00NB
|
||||
lemoy:
|
||||
hosts:
|
||||
lemoy-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.33.11
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0ZQ
|
||||
lemoy-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.33.21
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0ZR
|
||||
lemoy-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.33.31
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0Y5
|
||||
lemoy-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.33.5
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0Y4
|
||||
lemoy-mdf-a8360-sw1:
|
||||
ansible_host: 10.33.254.253
|
||||
building_name: lemoy
|
||||
serial_num: SG37LP00NS
|
||||
lemoy-mdf-a8360-sw2:
|
||||
ansible_host: 10.33.254.254
|
||||
building_name: lemoy
|
||||
serial_num: SG37LP00N6
|
||||
lucy:
|
||||
hosts:
|
||||
lucy-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.86.205
|
||||
building_name: lucy
|
||||
serial_num: SG3AKMY24Q
|
||||
lucy-mdf-a8360-sw1:
|
||||
ansible_host: 10.250.205.86
|
||||
building_name: lucy
|
||||
serial_num: SG37LP00MT
|
||||
noc:
|
||||
hosts:
|
||||
noc-a6300-sw1:
|
||||
ansible_host: 192.168.101.8
|
||||
building_name: noc
|
||||
serial_num: SG43LMQ0XN
|
||||
psla:
|
||||
hosts:
|
||||
psla-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.3.11
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY24R
|
||||
psla-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.3.21
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY241
|
||||
psla-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.3.31
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2L9
|
||||
psla-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.3.41
|
||||
building_name: psla
|
||||
serial_num: SG3ALMQ1ZG
|
||||
psla-idf4-a6300-sw2:
|
||||
ansible_host: 192.168.3.42
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2MF
|
||||
psla-idf5-a6300-sw1:
|
||||
ansible_host: 192.168.3.51
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2LC
|
||||
psla-idf6-a6300-sw1:
|
||||
ansible_host: 192.168.3.61
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2LF
|
||||
psla-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.3.5
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY23X
|
||||
psla-mdf-a6300-sw2:
|
||||
ansible_host: 192.168.3.6
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY23Z
|
||||
psla-mdf-a8360-sw1:
|
||||
ansible_host: 10.3.254.253
|
||||
building_name: psla
|
||||
serial_num: SG30LP009D
|
||||
psla-mdf-a8360-sw2:
|
||||
ansible_host: 10.3.254.254
|
||||
building_name: psla
|
||||
serial_num: SG37LP00N7
|
||||
rober:
|
||||
hosts:
|
||||
rober-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.42.11
|
||||
building_name: rober
|
||||
serial_num: SG3AKMY0ZK
|
||||
rober-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.42.5
|
||||
building_name: rober
|
||||
serial_num: SG3AKMY0Y6
|
||||
rober-mdf-a8360-sw1:
|
||||
ansible_host: 10.42.254.253
|
||||
building_name: rober
|
||||
serial_num: SG37LP00N8
|
||||
rober-mdf-a8360-sw2:
|
||||
ansible_host: 10.42.254.254
|
||||
building_name: rober
|
||||
serial_num: SG30LP007Y
|
||||
sh:
|
||||
hosts:
|
||||
sh-noc-a8325-a:
|
||||
ansible_host: 10.255.255.4
|
||||
building_name: sh
|
||||
serial_num: TW35KM303L
|
||||
sh-noc-a8325-b:
|
||||
ansible_host: 10.255.255.5
|
||||
building_name: sh
|
||||
serial_num: TW33KM303K
|
||||
sh-noc-a8360-1-a:
|
||||
ansible_host: 192.168.114.11
|
||||
building_name: sh
|
||||
serial_num: SG39LNZ06G
|
||||
sh-noc-a8360-1-b:
|
||||
ansible_host: 192.168.114.21
|
||||
building_name: sh
|
||||
serial_num: SG36LNZ0XQ
|
||||
sh-noc-a8360-2-a:
|
||||
ansible_host: 192.168.114.238
|
||||
building_name: sh
|
||||
serial_num: SG36LNZ0XM
|
||||
sh-noc-a8360-5-a:
|
||||
ansible_host: 192.168.114.15
|
||||
building_name: sh
|
||||
serial_num: SG33LP1051
|
||||
sh-noc-a8360-5-b:
|
||||
ansible_host: 192.168.114.25
|
||||
building_name: sh
|
||||
serial_num: SG37LP101Y
|
||||
sh-noc-ilo-a6300-a:
|
||||
ansible_host: 192.168.114.19
|
||||
building_name: sh
|
||||
serial_num: SG38LMV05V
|
||||
shea:
|
||||
hosts:
|
||||
shea-noc-a6300-sw1:
|
||||
ansible_host: 192.168.114.8
|
||||
building_name: shea
|
||||
serial_num: SG30LMQ3TQ
|
||||
weeks:
|
||||
hosts:
|
||||
weeks-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.34.11
|
||||
building_name: weeks
|
||||
serial_num: SG3AKMY210
|
||||
weeks-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.34.5
|
||||
building_name: weeks
|
||||
serial_num: SG3AKMY21R
|
||||
weeks-mdf-a8360-sw1:
|
||||
ansible_host: 10.34.254.253
|
||||
building_name: weeks
|
||||
serial_num: SG37LP00NN
|
||||
weeks-mdf-a8360-sw2:
|
||||
ansible_host: 10.34.254.254
|
||||
building_name: weeks
|
||||
serial_num: SG30LP0095
|
||||
|
||||
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"
|
||||
|
||||
@ -2,5 +2,7 @@
|
||||
|
||||
docker run --rm -e DFLT_PASSWORD=$DFLT_PASSWORD -e DFLT_USERNAME=$DFLT_USERNAME -e PASSWORD=$PASSWORD -e USERNAME=$USERNAME -v /home/johnp/scsd-configs/git:/repo -v /home/johnp/scsd-configs/git/code:/work -v /home/johnp/scsd-configs/git/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/git:/repo -v /home/johnp/scsd-configs/git/code:/work -v /home/johnp/scsd-configs/git/configs/:/configs --privileged -t scsdansible ./run_backup_configs-cisco.sh
|
||||
docker run --rm -e WLC_PASSWORD=$WLC_PASSWORD -e DFLT_PASSWORD=$DFLT_PASSWORD -e DFLT_USERNAME=$DFLT_USERNAME -e PASSWORD=$PASSWORD -e USERNAME=$USERNAME -v /home/johnp/scsd-configs/git:/repo -v /home/johnp/scsd-configs/git/code:/work -v /home/johnp/scsd-configs/git/configs/:/configs --privileged -t scsdansible:pyexpect ./run_backup_wlcs.sh
|
||||
sed -i -E 's/(key|ipsec|wpa-passphrase|password) ([a-f0-9]+) $/ \1 *redacted*/' /home/johnp/scsd-configs/git/configs/wlc/wlc*cfg
|
||||
|
||||
/home/johnp/scsd-configs/git/code/run_git.sh
|
||||
|
||||
@ -3,263 +3,375 @@ bova:
|
||||
bova-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.41.11
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06M
|
||||
bova-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.41.21
|
||||
building_name: bova
|
||||
serial_num: SG31KMY063
|
||||
bova-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.41.31
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06C
|
||||
bova-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.41.41
|
||||
building_name: bova
|
||||
serial_num: SG31KMY06Q
|
||||
bova-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.41.5
|
||||
building_name: bova
|
||||
serial_num: SG29KMY1MH
|
||||
bova-mdf-a8360-sw1:
|
||||
ansible_host: 10.41.254.253
|
||||
building_name: bova
|
||||
serial_num: SG23KRR023
|
||||
bova-mdf-a8360-sw2:
|
||||
ansible_host: 10.41.254.254
|
||||
building_name: bova
|
||||
serial_num: SG23KRR01C
|
||||
bright:
|
||||
hosts:
|
||||
bright-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.46.5
|
||||
building_name: bright
|
||||
serial_num: SG43KMY029
|
||||
bright-mdf-a8360-sw1:
|
||||
ansible_host: 192.168.46.1
|
||||
building_name: bright
|
||||
serial_num: SG3AL5K03S
|
||||
clary:
|
||||
hosts:
|
||||
clary-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.8.11
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY23T
|
||||
clary-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.8.21
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY1ZR
|
||||
clary-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.8.31
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY257
|
||||
clary-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.8.5
|
||||
building_name: clary
|
||||
serial_num: SG3AKMY24Z
|
||||
clary-mdf-a8360-sw1:
|
||||
ansible_host: 10.8.254.253
|
||||
building_name: clary
|
||||
serial_num: SG37LP00MX
|
||||
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-a6300-sw2:
|
||||
ansible_host: 192.168.3.6
|
||||
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
|
||||
serial_num: SG30LP0098
|
||||
ct:
|
||||
hosts:
|
||||
ct-noc-a8325-a:
|
||||
ansible_host: 192.168.101.2
|
||||
building_name: ct
|
||||
serial_num: TW33KM302P
|
||||
ct-noc-a8325-b:
|
||||
ansible_host: 192.168.101.3
|
||||
building_name: ct
|
||||
serial_num: TW35KM307F
|
||||
ct-noc-a8360-1-a:
|
||||
ansible_host: 192.168.101.11
|
||||
ansible_host: 10.251.1.253
|
||||
building_name: ct
|
||||
serial_num: SG36LNZ0XG
|
||||
ct-noc-a8360-1-b:
|
||||
ansible_host: 192.168.101.21
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06Y
|
||||
ct-noc-a8360-2-a:
|
||||
ansible_host: 192.168.101.12
|
||||
building_name: ct
|
||||
serial_num: SG37LNZ02Y
|
||||
ct-noc-a8360-2-b:
|
||||
ansible_host: 192.168.101.22
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06C
|
||||
ct-noc-a8360-3-a:
|
||||
ansible_host: 192.168.101.13
|
||||
building_name: ct
|
||||
serial_num: SG37LNZ02R
|
||||
ct-noc-a8360-3-b:
|
||||
ansible_host: 192.168.101.23
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ070
|
||||
ct-noc-a8360-4-a:
|
||||
ansible_host: 192.168.101.14
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06H
|
||||
ct-noc-a8360-4-b:
|
||||
ansible_host: 192.168.101.24
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ073
|
||||
ct-noc-a8360-5-a:
|
||||
ansible_host: 192.168.101.15
|
||||
building_name: ct
|
||||
serial_num: SG34LP1006
|
||||
ct-noc-a8360-5-b:
|
||||
ansible_host: 192.168.101.25
|
||||
building_name: ct
|
||||
serial_num: SG34LP10K4
|
||||
ct-noc-a8360-6-a:
|
||||
ansible_host: 192.168.101.16
|
||||
building_name: ct
|
||||
serial_num: SG37LP102H
|
||||
ct-noc-a8360-6-b:
|
||||
ansible_host: 192.168.101.26
|
||||
building_name: ct
|
||||
serial_num: SG34LP1008
|
||||
ct-noc-a8360-7-a:
|
||||
ansible_host: 192.168.101.17
|
||||
building_name: ct
|
||||
serial_num: SG33LP104Y
|
||||
ct-noc-a8360-7-b:
|
||||
ansible_host: 192.168.101.27
|
||||
building_name: ct
|
||||
serial_num: SG37LP101D
|
||||
ct-noc-a8360-8-a:
|
||||
ansible_host: 192.168.101.18
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ071
|
||||
ct-noc-a8360-8-b:
|
||||
ansible_host: 192.168.101.28
|
||||
building_name: ct
|
||||
serial_num: SG39LNZ06V
|
||||
ct-noc-ilo-a6300-a:
|
||||
ansible_host: 192.168.101.19
|
||||
building_name: ct
|
||||
serial_num: SG38LMV05R
|
||||
ct-noc-ilo-a6300-b:
|
||||
ansible_host: 192.168.101.29
|
||||
building_name: ct
|
||||
serial_num: SG38LMV08Q
|
||||
enl:
|
||||
hosts:
|
||||
enl-mdf-a8360-sw1:
|
||||
ansible_host: 10.250.204.66
|
||||
building_name: enl
|
||||
serial_num: SG41L5K0M3
|
||||
hwsmi:
|
||||
hosts:
|
||||
hwsmi-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.15.11
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY2JF
|
||||
hwsmi-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.15.21
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY24T
|
||||
hwsmi-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.15.31
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY22T
|
||||
hwsmi-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.15.41
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY2JC
|
||||
hwsmi-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.15.5
|
||||
building_name: hwsmi
|
||||
serial_num: SG3AKMY22Z
|
||||
hwsmi-mdf-a8360-sw1:
|
||||
ansible_host: 10.15.254.253
|
||||
building_name: hwsmi
|
||||
serial_num: SG37LP00N0
|
||||
hwsmi-mdf-a8360-sw2:
|
||||
ansible_host: 10.15.254.254
|
||||
building_name: hwsmi
|
||||
serial_num: SG30LP008P
|
||||
itc:
|
||||
hosts:
|
||||
itc-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.2.11
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY244
|
||||
itc-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.2.21
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY247
|
||||
itc-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.2.31
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY250
|
||||
itc-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.2.5
|
||||
building_name: itc
|
||||
serial_num: SG3AKMY248
|
||||
itc-mdf-a8360-sw1:
|
||||
ansible_host: 10.2.254.253
|
||||
building_name: itc
|
||||
serial_num: SG30LP009H
|
||||
itc-mdf-a8360-sw2:
|
||||
ansible_host: 10.2.254.254
|
||||
building_name: itc
|
||||
serial_num: SG37LP00NB
|
||||
lemoy:
|
||||
hosts:
|
||||
lemoy-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.33.11
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0ZQ
|
||||
lemoy-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.33.21
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0ZR
|
||||
lemoy-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.33.31
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0Y5
|
||||
lemoy-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.33.5
|
||||
building_name: lemoy
|
||||
serial_num: SG3AKMY0Y4
|
||||
lemoy-mdf-a8360-sw1:
|
||||
ansible_host: 10.33.254.253
|
||||
building_name: lemoy
|
||||
serial_num: SG37LP00NS
|
||||
lemoy-mdf-a8360-sw2:
|
||||
ansible_host: 10.33.254.254
|
||||
building_name: lemoy
|
||||
serial_num: SG37LP00N6
|
||||
lucy:
|
||||
hosts:
|
||||
lucy-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.86.5
|
||||
building_name: lucy
|
||||
serial_num: SG3AKMY24Q
|
||||
lucy-mdf-a8360-sw1:
|
||||
ansible_host: 10.86.254.254
|
||||
building_name: lucy
|
||||
serial_num: SG37LP00MT
|
||||
noc:
|
||||
hosts:
|
||||
noc-a6300-sw1:
|
||||
ansible_host: 192.168.101.8
|
||||
building_name: noc
|
||||
serial_num: SG43LMQ0XN
|
||||
psla:
|
||||
hosts:
|
||||
psla-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.3.11
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY24R
|
||||
psla-idf2-a6300-sw1:
|
||||
ansible_host: 192.168.3.21
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY241
|
||||
psla-idf3-a6300-sw1:
|
||||
ansible_host: 192.168.3.31
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2L9
|
||||
psla-idf4-a6300-sw1:
|
||||
ansible_host: 192.168.3.41
|
||||
building_name: psla
|
||||
serial_num: SG3ALMQ1ZG
|
||||
psla-idf4-a6300-sw2:
|
||||
ansible_host: 192.168.3.42
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2MF
|
||||
psla-idf5-a6300-sw1:
|
||||
ansible_host: 192.168.3.51
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2LC
|
||||
psla-idf6-a6300-sw1:
|
||||
ansible_host: 192.168.3.61
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY2LF
|
||||
psla-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.3.5
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY23X
|
||||
psla-mdf-a6300-sw2:
|
||||
ansible_host: 192.168.3.6
|
||||
building_name: psla
|
||||
serial_num: SG3AKMY23Z
|
||||
psla-mdf-a8360-sw1:
|
||||
ansible_host: 10.3.254.253
|
||||
building_name: psla
|
||||
serial_num: SG30LP009D
|
||||
psla-mdf-a8360-sw2:
|
||||
ansible_host: 10.3.254.254
|
||||
building_name: psla
|
||||
serial_num: SG37LP00N7
|
||||
rober:
|
||||
hosts:
|
||||
rober-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.42.11
|
||||
building_name: rober
|
||||
serial_num: SG3AKMY0ZK
|
||||
rober-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.42.5
|
||||
building_name: rober
|
||||
serial_num: SG3AKMY0Y6
|
||||
rober-mdf-a8360-sw1:
|
||||
ansible_host: 10.42.254.253
|
||||
building_name: rober
|
||||
serial_num: SG37LP00N8
|
||||
rober-mdf-a8360-sw2:
|
||||
ansible_host: 10.42.254.254
|
||||
building_name: rober
|
||||
serial_num: SG30LP007Y
|
||||
sh:
|
||||
hosts:
|
||||
sh-noc-a8325-a:
|
||||
ansible_host: 192.168.114.4
|
||||
building_name: sh
|
||||
serial_num: TW35KM303L
|
||||
sh-noc-a8325-b:
|
||||
ansible_host: 192.168.114.5
|
||||
ansible_host: 10.255.255.5
|
||||
building_name: sh
|
||||
serial_num: TW33KM303K
|
||||
sh-noc-a8360-1-a:
|
||||
ansible_host: 192.168.114.11
|
||||
building_name: sh
|
||||
serial_num: SG39LNZ06G
|
||||
sh-noc-a8360-1-b:
|
||||
ansible_host: 192.168.114.21
|
||||
building_name: sh
|
||||
serial_num: SG36LNZ0XQ
|
||||
sh-noc-a8360-2-a:
|
||||
ansible_host: 192.168.114.238
|
||||
building_name: sh
|
||||
serial_num: SG36LNZ0XM
|
||||
sh-noc-a8360-5-a:
|
||||
ansible_host: 192.168.114.15
|
||||
building_name: sh
|
||||
serial_num: SG33LP1051
|
||||
sh-noc-a8360-5-b:
|
||||
ansible_host: 192.168.114.25
|
||||
building_name: sh
|
||||
serial_num: SG37LP101Y
|
||||
sh-noc-ilo-a6300-a:
|
||||
ansible_host: 192.168.114.19
|
||||
building_name: sh
|
||||
serial_num: SG38LMV05V
|
||||
shea:
|
||||
hosts:
|
||||
shea-noc-a6300-sw1:
|
||||
ansible_host: 192.168.114.8
|
||||
building_name: shea
|
||||
serial_num: SG30LMQ3TQ
|
||||
weeks:
|
||||
hosts:
|
||||
weeks-idf1-a6300-sw1:
|
||||
ansible_host: 192.168.34.11
|
||||
building_name: weeks
|
||||
serial_num: SG3AKMY210
|
||||
weeks-mdf-a6300-sw1:
|
||||
ansible_host: 192.168.34.5
|
||||
building_name: weeks
|
||||
serial_num: SG3AKMY21R
|
||||
weeks-mdf-a8360-sw1:
|
||||
ansible_host: 10.34.254.253
|
||||
building_name: weeks
|
||||
serial_num: SG37LP00NN
|
||||
weeks-mdf-a8360-sw2:
|
||||
ansible_host: 10.34.254.254
|
||||
building_name: weeks
|
||||
serial_num: SG30LP0095
|
||||
|
||||
all:
|
||||
vars:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert ac3383137ff2554a78858b218ec3126bf7a779db83d4e7ba4affc9d8827fa69f --password=$PASSWORD &
|
||||
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert fda7d7ed64a9bd84562c6643e858c4a61cfdc6e90b0d4ee60e07fd0bb7fb7a9f --password=$PASSWORD &
|
||||
while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ];
|
||||
do
|
||||
#echo checking
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert ac3383137ff2554a78858b218ec3126bf7a779db83d4e7ba4affc9d8827fa69f --password=$PASSWORD &
|
||||
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert fda7d7ed64a9bd84562c6643e858c4a61cfdc6e90b0d4ee60e07fd0bb7fb7a9f --password=$PASSWORD &
|
||||
while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ];
|
||||
do
|
||||
#echo checking
|
||||
@ -7,4 +7,7 @@ do
|
||||
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
|
||||
|
||||
run_backup_wlcs.sh
|
||||
|
||||
chown -R 1000:1000 /configs/
|
||||
|
||||
31
code/run_backup_wlcs.sh
Executable file
31
code/run_backup_wlcs.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/bash
|
||||
openfortivpn vpn.scsd.us:10443 --username=$USERNAME --trusted-cert fda7d7ed64a9bd84562c6643e858c4a61cfdc6e90b0d4ee60e07fd0bb7fb7a9f --password=$PASSWORD &
|
||||
while [ ! `ip a | grep -q "inet .*ppp" && echo "1"` ];
|
||||
do
|
||||
#echo checking
|
||||
sleep 1
|
||||
done
|
||||
sleep 3
|
||||
mkdir /configs/wlc
|
||||
fn=wlc-a.cfg
|
||||
ip=10.1.35.11
|
||||
python backup_wlcs.py --user admin --password $WLC_PASSWORD --ip $ip --filename /configs/wlc/$fn
|
||||
|
||||
fn=wlc-b.cfg
|
||||
ip=10.1.35.12
|
||||
python backup_wlcs.py --user admin --password $WLC_PASSWORD --ip $ip --filename /configs/wlc/$fn
|
||||
|
||||
fn=wlc-c.cfg
|
||||
ip=10.1.35.14
|
||||
python backup_wlcs.py --user admin --password $WLC_PASSWORD --ip $ip --filename /configs/wlc/$fn
|
||||
|
||||
fn=wlc-mm.cfg
|
||||
ip=10.1.35.13
|
||||
python backup_wlcs.py --user admin --password $WLC_PASSWORD --ip $ip --filename /configs/wlc/$fn
|
||||
|
||||
fn=wlc-mm-2.cfg
|
||||
ip=10.1.35.23
|
||||
python backup_wlcs.py --user admin --password $WLC_PASSWORD --ip $ip --filename /configs/wlc/$fn
|
||||
|
||||
|
||||
chown -R 1000:1000 /configs/
|
||||
@ -10,3 +10,4 @@ do
|
||||
git commit -m "$f $datestamp"
|
||||
done
|
||||
|
||||
git push
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user