Skip to content

Instantly share code, notes, and snippets.

Avatar

Tommy McNeely TJM

View GitHub Profile
@TJM
TJM / sync_ipa_sshkeys.rb
Last active Aug 29, 2015
Sync IPA SSH Keys to Stash from @phemmer
View sync_ipa_sshkeys.rb
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'rubygems'
require 'net/ldap'
require 'timeout'
require 'json'
require 'base64'
require 'resolv'
@TJM
TJM / graylog2.pp
Created Jan 8, 2015
graylog2 puppet profile
View graylog2.pp
#
# === Class: lark::profile::graylog2
#
# Setup GrayLog2 Server
# GrayLog 2 also needs redis and elasticsearch
#
# === Parameters
#
# - secret - graylog2 secret (string >64 chars) - no default
# - root_password_sha2 - graylog2 root pass (string) - no default (sha256sum)
@TJM
TJM / staging.php
Last active Aug 29, 2015
Lookup Akamai Staging Hosts to create a hosts file entry
View staging.php
#!/usr/bin/php
<?php
# Convert a hostname to an "Akamai Staging" DNS entry
$parameters = array(
'h' => 'help',
'd' => 'debug'
);
$DEBUG = true;
@TJM
TJM / fix_hosts
Created May 1, 2015
Foreman fix_hosts
View fix_hosts
<%#
kind: snippet
name: fix_hosts
%>
echo "<%= @host %>" > /etc/hostname
hostname <%= @host %>
# CentOS 7 (Fedora 19+?) uses hostnamectl
[ -x /usr/bin/hostnamectl ] && /usr/bin/hostnamectl set-hostname <%= @host %>
@TJM
TJM / LarkIT-CentOS-Finish.erb
Last active Aug 5, 2016
LarkIT-Foreman-Finish-Scripts
View LarkIT-CentOS-Finish.erb
<%#
kind: finish
name: LarkIT-CentOS-Finish
oses:
- CentOS 4
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 16
- Fedora 17
@TJM
TJM / dumper.rb
Last active Aug 29, 2015
dumper.io initializer
View dumper.rb
# 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 / Force_MFA
Created Mar 20, 2017
Force Multi-Factor Authentication (MFA) on AWS IAM Accounts
View Force_MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountSummary"
@TJM
TJM / pe-backup.sh
Created Jun 7, 2017
Puppet Enterprise Backup
View pe-backup.sh
#!/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 / README.md
Last active Feb 12, 2021
Puppet SCCM Client Install as a package
View README.md

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 / win_bootstrap.ps1
Created Aug 10, 2017
Attempted / Broken Windows Bootstrap script
View win_bootstrap.ps1
<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}"