Skip to content

thisguyshouldworkforus/python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

A simple repo to hold scripts that I have written over the years for a variety of purposes

License

GPLv3 License

Bootstrap Wrapper



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 import timeout
      • from urllib.request import Request, urlopen
      • from urllib.error import URLError, 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])
    • 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
    • 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
          • if fail:
            • print error
        • catch exception (HTTPError, URLError, timeout)

Automate the SNOW Chef SCTASK Server Decommission Queue (Cleanup)



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.

Purpose

  • 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)

Method

  • Written in Python
    • API Communication with Service Now to enable automation
    • Queue is monitored for new tickets every 5 minutes

About

A repository to hold python scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages