UPDATED AND ADDED ENV FOR USER/PASS
This commit is contained in:
parent
5798adb14e
commit
a1461e66ce
|
@ -48,3 +48,4 @@ Thumbs.db
|
|||
*.mov
|
||||
*.wmv
|
||||
|
||||
.env
|
|
@ -4,28 +4,35 @@
|
|||
Script to sync arista vlan from a primary to secondary switches
|
||||
'''
|
||||
|
||||
import os
|
||||
import re
|
||||
import paramiko
|
||||
import time
|
||||
|
||||
# environment stuff
|
||||
from dotenv import load_dotenv
|
||||
from pathlib import Path # python3 only
|
||||
env_path = Path('.') / '.env'
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
|
||||
# Define master switch details
|
||||
MASTER_SWITCH = {
|
||||
"ip": "23.169.120.2",
|
||||
"username": "sbutler",
|
||||
"password": "tori1806"
|
||||
"username": os.getenv("SSHUSER"),
|
||||
"password": os.getenv("SSHPASS")
|
||||
}
|
||||
|
||||
# Define list of switches to sync with (with parameters)
|
||||
SWITCHES = [
|
||||
{
|
||||
"ip": "23.169.120.3",
|
||||
"username": "sbutler",
|
||||
"password": "tori1806"
|
||||
"username": os.getenv("SSHUSER"),
|
||||
"password": os.getenv("SSHPASS")
|
||||
},
|
||||
{
|
||||
"ip": "23.169.120.4",
|
||||
"username": "sbutler",
|
||||
"password": "tori1806"
|
||||
"username": os.getenv("SSHUSER"),
|
||||
"password": os.getenv("SSHPASS")
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -34,6 +41,7 @@ SWITCHES = [
|
|||
PROTECTED_VLANS = ("1")
|
||||
|
||||
def sync_vlans(master_switch, switch):
|
||||
|
||||
# Establish SSH connection to master switch
|
||||
master_client = paramiko.SSHClient()
|
||||
master_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
|
Loading…
Reference in New Issue