A simple repo to hold scripts that I have written over the years for a variety of purposes
system_bootstrap.py is a script that will gather information about the system it is being run on and use that information to bootstrap the system for RedHat Satellite.
- In this script, it will:
- Import Modules
socket
,os
,urllib
,logging
,platform
,shutil
- from
socket
importtimeout
- from
urllib.request
importRequest
,urlopen
- from
urllib.error
importURLError
,HTTPError
- Set PS1 Prompt color
- Ensure only ROOT or another SuperUser runs this script
- Set Variables
- hostname =
socket.getfqdn()
- shortname =
str(hostname.split('.')[0])
- environment =
shortname[-4]
- datacenter =
shortname[-3]
- servertype =
shortname[-1]
- os_info =
platform.uname().release
- release =
platform.platform().split('-')
- ver =
str(release[6])
- dist = 'el' +
str(ver.split('.')[0])
- hostname =
- Determine the SERVER and ACTIVATION KEY to use
- Print our variables out, to ensure we captured them correctly
- Build our strings for the SERVER connection
- connection =
https://
+SERVER
+:8443/rhsm
- file_name =
bootstrap.py
- download =
https://
+SERVER
+:443/pub/
+file_name
- connection =
- Test our connection to the SERVER
- try block
- response =
urllib.request.urlopen(connection, timeout=10)
- test if response code is
200
- if success:
- download RedHat Satellite
bootstrap.py
- run
bootstrap.py
- download RedHat Satellite
- if fail:
- print error
- if success:
- catch exception (HTTPError, URLError, timeout)
- response =
- try block
- Import Modules
Chef SCTASK Cleanup is a project intended to automate the previously manual task of searching for and deleting nodes from the Chef Infra Server, and then closing those tickets with the proper disposition. This project was developed while employed with Honeywell, and this project is shared with their knowledge and explicit permission.
- Create an automated solution to daily cleanups of the Service Now Queue:
- All > Request Item = Server Decommission > Active = true > Assignment Group = Chef App Support (CORP:CCP)
- Written in Python
- API Communication with Service Now to enable automation
- Queue is monitored for new tickets every 5 minutes