Skip to content

Instantly share code, notes, and snippets.

View TJM's full-sized avatar

Tommy McNeely TJM

View GitHub Profile
@TJM
TJM / dash.wsgi
Last active October 23, 2018 14:00
WSGI file for a Dash / Plotly app with no hard coded paths. Picks up the "prefix" for DASH through the WSGI environment variable SCRIPT_NAME and uses the virtualenv "venv"
import os
import sys
my_directory=os.path.dirname(__file__)
if my_directory not in sys.path:
sys.path.insert(0,my_directory)
# Virtual Environment (./venv)
activate_this = os.path.join(my_directory, 'venv', 'bin', 'activate_this.py')
@TJM
TJM / catalog
Created October 17, 2018 21:26
Puppet Catalog script
#!/bin/bash
#
# catalog
# John Simpson <jms1@jms1.net> 2015-10-30
#
# Prints a Puppet node's catalog file.
# This *should* work with both OSP and PE.
#
# 2017-10-11 jms1 - adding "run" option
@TJM
TJM / Jenkinsfile
Last active October 25, 2018 20:23
First (workable) attempt at using Pipeline for Puppet control-repo code testing and deployment - Uses the Mesos plugin to spin up slaves as "cloud1" and the Puppet Enterprise plugin for deployment https://wiki.jenkins.io/display/JENKINS/Puppet+Enterprise+Pipeline+Plugin
#!/usr/bin/env groovy
// NOTE:
// * This is designed to work as a Multi-Branch PIPELINE buid.
// * Our Jenkins Slave is mesos and labeled "cloud1" (you may need to adjust)
// * This uses the Puppet Enterprise Jenkins plugin. It assumes that is setup
// * Also there needs to be a credential (API KEY) with the id of "puppet"
pipeline {
//agent { label 'cloud1' }
@TJM
TJM / Feedback.md
Last active April 23, 2018 18:53
Puppet Language Basics Feedback

Puppet Language Basics Feedback

I am taking this course as an "expert" for feedback purposes. I am being particularly nit-picky because that is what I would want if I asked for feedback :)

General Feedback

  • Put the section "title" at the top. Maybe this would only help during the feedback phase, but I had to wait till I got to the next section to find out the title of the first one. (on the back button)
  • If the test button is "disabled" there needs to be a reason
  • There are several places where it is obvious that rspec is being used (from the errors), but upon success, I get the output passed which really doesn't need to be there. I recommend omitting the "passed" output if that is all there is, stick with the bold text "success" that is already there. In several cases, it might be better to have the puppet output, but in others it is probably not useful.
  • The "errors" from the rspec-puppet tests made sense to me, but I think for a "Puppet 101" course, rspec-puppet is not going to be useful. The
@TJM
TJM / win_bootstrap.ps1
Created August 10, 2017 16:51
Attempted / Broken Windows Bootstrap script
<powershell>
$domain = "${ad_domain}"
$password = "${joiner_pw}" | ConvertTo-SecureString -asPlainText -Force
$username = "${ad_shortname}\${joiner_account}"
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$puppet_master_server = "${puppet_server}"
$puppet_agent_environment = "${puppet_env}"
$puppet_role = "${role}"
@TJM
TJM / README.md
Last active March 25, 2023 01:16
Puppet SCCM Client Install as a package

SCCM Install using Puppet "package"

This script was donated by a customer of ours. They have sent us a sanitized version of the script to share.

Please use this at your own risk, and fully understand what it is doing before using it!

The Problem:

SCCM Installation fires off in the background and you have no idea whether it worked or not. Also, if any other installs try to start while the SCCM setup is running, you will get an error.

@TJM
TJM / pe-backup.sh
Created June 7, 2017 18:02
Puppet Enterprise Backup
#!/bin/bash -e
# Simple Backup for Puppet Enterprise assuming all defaults and monolithic
BACKUPROOT=/backup
KEEPDAYS=30
BACKUPDIR="${BACKUPROOT}/$(date +%F-%T)"
# Backup Files
umask 077
mkdir -p "${BACKUPDIR}"
@TJM
TJM / Force_MFA
Created March 20, 2017 16:45
Force Multi-Factor Authentication (MFA) on AWS IAM Accounts
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountSummary"
@TJM
TJM / dumper.rb
Last active August 29, 2015 14:24
dumper.io initializer
# Initialize Dumper.IO agent if the secret is present
dumper_app_key = Rails.application.secrets.dumper_app_key
if dumper_app_key.to_s.eql?('DISABLE')
Rails.logger.warn "Database Backup (dumper) is DISABLED due to dumper_app_key"
elsif dumper_app_key.nil?
Rails.logger.warn("No dumper_app_key specified in secrets.yml, not running Database Backup (dumper)")
abort("You must set dumper_app_key in secrets.yml for production. You can set to 'DISABLE' if you don't want it to run.") if Rails.env.production?
else
Dumper::Agent.start(:app_key => dumper_app_key)
@TJM
TJM / LarkIT-CentOS-Finish.erb
Last active August 5, 2016 05:46
LarkIT-Foreman-Finish-Scripts
<%#
kind: finish
name: LarkIT-CentOS-Finish
oses:
- CentOS 4
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 16
- Fedora 17