From 333c4b17686758f4c26caa6af2dc7874d63cdea8 Mon Sep 17 00:00:00 2001 From: gblow Date: Wed, 12 Jun 2024 15:43:42 +0100 Subject: [PATCH] write basic --- README.md | 1 + apply-hostnames.py | 6 ++++++ apply-licenses.py | 4 ++++ get-MACs.py | 4 ++++ get-serials.py | 9 +++++++++ set-ipmi-enabled.py | 9 +++++++++ 6 files changed, 33 insertions(+) diff --git a/README.md b/README.md index e69de29..cd7d302 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +This repository contains a number of scripts that are designed to interact with HPE iLO BMCs (Hewlett Packard Enterprises, integrated Lights Out, Baseboard Management Controllers ) to access information and provide limited actuation. If usage information is not provided through the help text for each script, care should be taken when determining what the script will do before running. \ No newline at end of file diff --git a/apply-hostnames.py b/apply-hostnames.py index 4a94237..519be6b 100644 --- a/apply-hostnames.py +++ b/apply-hostnames.py @@ -3,9 +3,15 @@ import argparse import paramiko import getpass import logging + +#Configure and commence logging + logger = logging.getLogger(__name__) logging.basicConfig(filename='python.log', level=logging.DEBUG) logger.debug('logging start') + + + with open('hosts-in.csv',encoding='utf8') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') next(csvreader) diff --git a/apply-licenses.py b/apply-licenses.py index ee48c58..b73971c 100644 --- a/apply-licenses.py +++ b/apply-licenses.py @@ -3,9 +3,13 @@ import argparse import paramiko import getpass import logging + +#Configure and commence logging + logger = logging.getLogger(__name__) logging.basicConfig(filename='python.log', level=logging.DEBUG) logger.debug('logging start') + with open('hosts-in.csv',encoding='utf8') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') next(csvreader) diff --git a/get-MACs.py b/get-MACs.py index e7b49f9..ede00b8 100644 --- a/get-MACs.py +++ b/get-MACs.py @@ -4,9 +4,13 @@ import paramiko import getpass import logging import re + +#Configure and commence logging + logger = logging.getLogger(__name__) logging.basicConfig(filename='python.log', level=logging.DEBUG) logger.debug('logging start') + with open('hosts-in.csv',encoding='utf8') as csvfile,open('MACs.csv','w') as csvfile_out: csvreader = csv.reader(csvfile, delimiter=',') csvwriter = csv.writer(csvfile_out) diff --git a/get-serials.py b/get-serials.py index daf717f..83b32e0 100644 --- a/get-serials.py +++ b/get-serials.py @@ -4,9 +4,18 @@ import paramiko import getpass import logging import re + +#Configure and commence logging + logger = logging.getLogger(__name__) logging.basicConfig(filename='python.log', level=logging.DEBUG) logger.debug('logging start') + +#Set up argument parsing + +parser = argparse.ArgumentParser("get-serials.py") +parser.add_argument(help="This script will access every host BMC in the hosts-in.csv list and retrieve the serial number for them, writing them out to a csv file, along with the system host name for identification.") + with open('hosts-in.csv',encoding='utf8') as csvfile,open('serials.csv','w') as csvfile_out: csvreader = csv.reader(csvfile, delimiter=',') csvwriter = csv.writer(csvfile_out) diff --git a/set-ipmi-enabled.py b/set-ipmi-enabled.py index b166a2e..cbdb04b 100644 --- a/set-ipmi-enabled.py +++ b/set-ipmi-enabled.py @@ -3,9 +3,18 @@ import argparse import paramiko import getpass import logging + +#Configure and commence logging + logger = logging.getLogger(__name__) logging.basicConfig(filename='python.log', level=logging.DEBUG) logger.debug('logging start') + +#Set up argument parsing + +parser = argparse.ArgumentParser("set-ipmi-enabled.py") +parser.add_argument(help="This script will take every host BMC in the hosts-in.csv list and set map1/config1 oemHPE_ipmi_dcmi_overlan_enable=yes on it.") + with open('hosts-in.csv',encoding='utf8') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') next(csvreader)