import argparse, arrange input csv, other tidying
This commit is contained in:
parent
bab32b9ee9
commit
d43ef9b093
6 changed files with 19 additions and 21 deletions
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import argparse
|
||||
import paramiko
|
||||
import getpass
|
||||
import logging
|
||||
|
@ -8,22 +9,20 @@ logger.debug('logging start')
|
|||
with open('hosts-in.csv',encoding='utf8') as csvfile:
|
||||
csvreader = csv.reader(csvfile, delimiter=',')
|
||||
next(csvreader)
|
||||
USER_NAME = input("Please enter BMC username:")
|
||||
PASSWORD=getpass.getpass()
|
||||
i = 1
|
||||
for row in csvreader:
|
||||
print(i)
|
||||
i += 1
|
||||
BMC_NAME = (row[0]+"-bmc")
|
||||
BMC_NAME = (row[1])
|
||||
HOST_NAME = (row[0])
|
||||
print(BMC_NAME)
|
||||
print(HOST_NAME)
|
||||
USER_NAME = "admin"
|
||||
if i > 0:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(hostname=BMC_NAME, look_for_keys=False, port=22, username=USER_NAME, password=PASSWORD, disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']})
|
||||
command = ("set system1 oemHPE_server_name="+HOST_NAME)
|
||||
#command = ("show /system1/")
|
||||
stdin, stdout, stderr = client.exec_command(command)
|
||||
print(stdout.read())
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import argparse
|
||||
import paramiko
|
||||
import getpass
|
||||
import logging
|
||||
|
@ -8,21 +9,20 @@ logger.debug('logging start')
|
|||
with open('hosts-in.csv',encoding='utf8') as csvfile:
|
||||
csvreader = csv.reader(csvfile, delimiter=',')
|
||||
next(csvreader)
|
||||
USER_NAME = input("Please enter BMC username:")
|
||||
PASSWORD=getpass.getpass()
|
||||
i = 1
|
||||
for row in csvreader:
|
||||
print(i)
|
||||
i += 1
|
||||
BMC_NAME = (row[0]+"-bmc")
|
||||
LICENSE_KEY = (row[7])
|
||||
BMC_NAME = (row[1])
|
||||
#This is legacy and needs a new column setting, depending on how implemented in future case. Should be quick to determine so leaving to do until relevant.
|
||||
#LICENSE_KEY = (row[7])
|
||||
print(BMC_NAME)
|
||||
#print(LICENSE_KEY)
|
||||
USER_NAME = "admin"
|
||||
if i > 0:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(hostname=BMC_NAME, look_for_keys=False, port=22, username=USER_NAME, password=PASSWORD, disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']})
|
||||
#command = ("OemHPE_licenseinstall /map1/oemHPE_license1 "+LICENSE_KEY)
|
||||
command = ("show /map1/oemHPE_license1")
|
||||
stdin, stdout, stderr = client.exec_command(command)
|
||||
print(stdout.read())
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import argparse
|
||||
import paramiko
|
||||
import getpass
|
||||
import logging
|
||||
|
@ -10,6 +11,7 @@ with open('hosts-in.csv',encoding='utf8') as csvfile,open('MACs.csv','w') as csv
|
|||
csvreader = csv.reader(csvfile, delimiter=',')
|
||||
csvwriter = csv.writer(csvfile_out)
|
||||
next(csvreader)
|
||||
USER_NAME = input("Please enter BMC username:")
|
||||
PASSWORD=getpass.getpass()
|
||||
i = 1
|
||||
P1_PATTERN=re.compile('Port1NIC_MACAddress=\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}')
|
||||
|
@ -17,10 +19,9 @@ with open('hosts-in.csv',encoding='utf8') as csvfile,open('MACs.csv','w') as csv
|
|||
P3_PATTERN=re.compile('Port3NIC_MACAddress=\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}')
|
||||
for row in csvreader:
|
||||
print(i)
|
||||
BMC_NAME = (row[0]+"-bmc")
|
||||
SYSTEM_NAME = ("ceph01-block02-"+row[0])
|
||||
BMC_NAME = (row[1])
|
||||
SYSTEM_NAME = (row[0])
|
||||
print(BMC_NAME)
|
||||
USER_NAME = "admin"
|
||||
if i > 0:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import argparse
|
||||
import paramiko
|
||||
import getpass
|
||||
import logging
|
||||
|
@ -10,17 +11,15 @@ with open('hosts-in.csv',encoding='utf8') as csvfile,open('serials.csv','w') as
|
|||
csvreader = csv.reader(csvfile, delimiter=',')
|
||||
csvwriter = csv.writer(csvfile_out)
|
||||
next(csvreader)
|
||||
USER_NAME = input("Please enter BMC username:")
|
||||
PASSWORD=getpass.getpass()
|
||||
i = 1
|
||||
SN_PATTERN=re.compile('number=\w{10}')
|
||||
for row in csvreader:
|
||||
print(i)
|
||||
BMC_NAME = (row[0]+"-bmc")
|
||||
LICENSE_KEY = (row[7])
|
||||
BMC_NAME = (row[1])
|
||||
SYSTEM_NAME = (row[0])
|
||||
print(BMC_NAME)
|
||||
#print(LICENSE_KEY)
|
||||
USER_NAME = "admin"
|
||||
if i > 0:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
hostname,bmc_name
|
|
|
@ -1,4 +1,5 @@
|
|||
import csv
|
||||
import argparse
|
||||
import paramiko
|
||||
import getpass
|
||||
import logging
|
||||
|
@ -8,22 +9,19 @@ logger.debug('logging start')
|
|||
with open('hosts-in.csv',encoding='utf8') as csvfile:
|
||||
csvreader = csv.reader(csvfile, delimiter=',')
|
||||
next(csvreader)
|
||||
USER_NAME = input("Please enter BMC username:")
|
||||
PASSWORD=getpass.getpass()
|
||||
i = 1
|
||||
for row in csvreader:
|
||||
print(i)
|
||||
i += 1
|
||||
BMC_NAME = (row[0]+"-bmc")
|
||||
HOST_NAME = (row[0])
|
||||
BMC_NAME = (row[1])
|
||||
print(BMC_NAME)
|
||||
print(HOST_NAME)
|
||||
USER_NAME = "admin"
|
||||
if i > 0:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(hostname=BMC_NAME, look_for_keys=False, port=22, username=USER_NAME, password=PASSWORD, disabled_algorithms={'pubkeys': ['rsa-sha2-256', 'rsa-sha2-512']})
|
||||
command = ("set map1/config1 oemHPE_ipmi_dcmi_overlan_enable=yes")
|
||||
#command = ("show map1/config1 oemHPE_ipmi_dcmi_overlan_enable")
|
||||
stdin, stdout, stderr = client.exec_command(command)
|
||||
print(stdout.read())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue