Skip to content

Instantly share code, notes, and snippets.

@sshastri
sshastri / chk_used_classes.rb
Created January 26, 2017 01:38
Compare PuppetDB with code base to find used classes
#!/opt/puppetlabs/puppet/bin/ruby
# Script to compare the classes applied by queerying the PuppetDB
# versus all the classes defined in a provided module path
#
# Command to run:
# /opt/puppetlabs/puppet/bin/ruby chk_used_classes.rb <module_path> <input_file>
#
# Arguments:
# @param module_path (required): Ex: /etc/puppetlabs/code/environments/production
@sshastri
sshastri / foo_status.rb
Last active May 25, 2017 04:09
Custom fact
Facter.add (:rhsm_deleted) do
confine :kernel => 'Linux'
setcode do
identity_output = Facter::Core::Execution.exec("cat /tmp/foo")
if identity_output.include?('not yet registered')
'not_registered'
elsif identity_output.include?('deleted')
'deleted'
@sshastri
sshastri / sqlserver.pp
Last active March 31, 2018 02:49
Use sqlserver module to execute SQL commands
class profile::app::sqlserver {
$version = '1.45'
sqlserver_instance{ 'MSSQLSERVER':
features => ['SQL'],
source => 'C:/setup',
sql_sysadmin_accounts => [$facts['id']],
}
@sshastri
sshastri / docker-compose.yml
Created June 12, 2018 22:13
docker-compose.yml
version: '2.1'
services:
cd4pe:
container_name: cd4pe
ports:
- "8080:8080"
- "7000:7000"
- "8000:8000"
image: pcr-internal.puppet.net/pipelines/pfi:latest
networks:
@sshastri
sshastri / get_environment.sh
Created August 10, 2018 17:12
environment.conf script
#! /bin/sh
if (( $# != 1 )); then
echo "Call this script with the name of the environment"
echo "Example: ${0} production"
exit 1
fi
CODEDIR='/etc/puppetlabs/code/environments'
CODESTAGE='/etc/puppetlabs/code-staging/environments'
# - Warning if pp_role not defined
# - Check to see if the role exists
# - Fall back to using the base profile
node default {
# Save the role fact into a local variable
$role = $facts['role']
case $role {
default: {
require 'date'
Facter.add(:cert_expire) do
confine :kernel => 'Linux'
setcode do
hostname = Facter.value(:hostname)
info = Facter::Core::Execution.execute("echo | openssl s_client -showcerts -connect #{hostname}:443 2>/dev/null | openssl x509 -noout -dates")
expire_info = {}
dates = info.split("\n")

Keybase proof

I hereby claim:

  • I am sshastri on github.
  • I am sshastri (https://keybase.io/sshastri) on keybase.
  • I have a public key whose fingerprint is F8C2 757B 7199 47C3 729D 06AB 3A1A A8BD B825 9CDC

To claim this, I am signing this object:

@sshastri
sshastri / NOLA.md
Created January 5, 2020 18:27
New Orleans

Don't know where you and your team will be staying but one thing to keep in mind is that New Orleans is more than just the French Quarter. By all means go explore and enjoy the FQ; it's beautiful and there's so much life and character. But it's worthwhile to explore outside of it too! So my recs are all over the place. There are a million "what to do in New Orleans" lists out there that are probably worth checking out (especially from Eater), but here's some stuff I like to do:

Food There are many excellent happy hours and great deals throughout the city, so bear that in mind!

  • Coop's Place: FQ Honestly the only place in the quarter I actively go to eat at. Quarter restaurants come off as real touristy with tourist prices, but this one is legit (despite the line of people, mostly tourists, often found going out the door, haha). Grungy, cash only, very tight space, almost guaranteed to have to wait in line (especially if in a bigger group), and the waitstaff has no patience for anyone's shit. But they
# from HashiCorp website
# Manage auth methods broadly across Vaults
path "auth/*"
{
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}
# Create, update, and delete auth methods
path "sys/auth/*"
{