
This script to configure multiple cisco devices , we need to put all IP addresses in the IPAdrresslist.txt file and change cmd1 and cmd2 of the script with required config commands
from future import print_function
from netmiko import ConnectHandler
import sys
import time
import select
import paramiko
import re
platform = ‘cisco_ios’
username = ‘XXXX’
password = ‘XXXX’
ip_add_file = open(‘ips.txt’,’r’)
for host in ip_add_file:
try:
device = ConnectHandler(device_type=platform, ip=host, username=username, password=password)
output = device.send_config_set([cmd1′,’cmd2′])
print(output)
except Exception:
print(“Unable to connect”)
Leave a comment