Skip to content

Instantly share code, notes, and snippets.

@op-ct
op-ct / rpm2metadata_json.rb
Created March 20, 2023 21:47
Quick & dirty RELENG check to fix/check for discrepancies between simp.spec deps and simp/simp_core's metadata.json
#!/opt/puppetlabs/bolt/bin/ruby
def get_rpm_spec_core(rpm_spec)
rpm_spec_core = {
requires: [],
obsoletes: [],
}
rpm_spec.select!{ |x| x =~ /^(Requires:|Obsoletes:|# Core SIMP Requirements|# SIMP Extras)/ }
in_core = false
rpm_spec.each do |x|
@op-ct
op-ct / REMINDER.md
Last active July 28, 2022 02:02
Manually register r10k GitLab runner with custom CA certs

PUSH gitlab_inventory UPDATES!

@op-ct
op-ct / _slim_repos.build-6-6-0-centos-8-x86-64-repo-packages.reposync.sh
Created October 21, 2021 14:50
Reposync experimental EL8 SIMP dev repos
#!/bin/sh
# On EL7, ensure:
# yum install -y dnf dnf-plugins-core
#
set -eu
# Useful EL8-only options: --remote-time --norepopath
PATH_TO_LOCAL_MIRROR="$PWD/_download_path/build-6-6-0-centos-8-x86-64-repo-packages"
mkdir -p "$PATH_TO_LOCAL_MIRROR"
dnf reposync \
@op-ct
op-ct / test_lookup.sh
Last active October 1, 2021 05:08
Test Puppet lookups from a local control repo
#!/bin/bash
/opt/puppetlabs/bolt/bin/puppet lookup \
--compile \
--explain \
--basemodulepath $PWD/site:/opt/puppetlabs/bolt/lib/ruby/gems/2.7.0/gems/bolt-3.17.0/modules \
--hiera_config $PWD/spec/hiera.yaml \
--environment production \
--environmentpath .onceover/etc/puppetlabs/code/environments \
--pluginfactdest "$PWD/facts.d" \
--log_level debug \
@op-ct
op-ct / onceover.rake
Created September 14, 2021 17:48
Rake tasks to help set up onceover spec tests
# frozen_string_literal: true
# These tasks help revionics use onceover to validate their manifests and data
#
# To prep and run onceover spec tests, run:
#
# bundler exec rake spec
#
namespace :onceover do
desc 'Install modules from Puppetfile, using private Puppet Forge'
@op-ct
op-ct / RPM-GPG-KEY-SIMP-UNSTABLE-2.gpg.asc
Last active June 25, 2021 16:37
SIMP Unstable GPG Key 2 (TESTING ONLY - NOT FOR PRODUCTION USE)
# SIMP Unstable GPG Key 2 (TESTING ONLY - NOT FOR PRODUCTION USE)
#
# NOTE: key is 3072 bit, but much smaller than previous keys
# because it is for signing ONLY, with no encryption subkeys
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGDTtTEBDAD5IhusLJZQhJ2CzzxXmY36fNEb8OUeahNpy5n8Ho/lyyZsfb2U
gfLYymQAdnIsKUk7AER3p4XRbV+AbxDlb25pbxWs6KaVLzXSgSw4VPyN50fDmVgu
cmTyso/ZFdFlGgdOtM2IoKWRM1/qt0SlaXDI5nTFQRINkFFfYwKci7P45c6L6G2e
@op-ct
op-ct / pupcat.rb
Last active September 29, 2020 20:57 — forked from happymcplaksin/pupcat.rb
pupcat.rb
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'yaml'
user = ARGV[0] || %x{id -u -n}.strip
if user == 'root'
dir = '/opt/puppetlabs/puppet/cache/client_data/catalog/'
@op-ct
op-ct / shareterminal.sh
Created September 2, 2020 16:21 — forked from jvaubourg/shareterminal.sh
Share a read-only tmux session over HTTPS with password
#!/bin/bash
# SERVER:
# sudo apt-get install certbot socat tmux
# sudo ./shareterminal.sh
# Your stage: tmux new-session -As remote
# Your spectators: tmux lsc -t remote
#
# CLIENTS:
# curl -N https://tmux.example.com:1337
@op-ct
op-ct / Gemfile
Created July 7, 2020 17:57
Configure GitLab CI <-> GitHub integration between all projects under a gitlab.com group with its parallel github.com org
# GEM_SERVERS | a space/comma delimited list of rubygem servers
gem_sources = ENV.key?('GEM_SERVERS') ? ENV['GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
gem_sources.each { |gem_source| source gem_source }
gem 'bundler'
gem 'dotenv'
gem 'gitlab'
gem 'json'
group :debug do
@op-ct
op-ct / Vagrantfile
Last active June 11, 2020 16:07
vagrant bolt testing setup
# Provision a bolt controller and various target systems
# - Sets up host file, hostnames, and SSH keys on each target
# - Just add project directory
SSH_KEY_FILE ||= File.join( ENV['VAGRANT_HOME'] || File.join(ENV['HOME'], '.vagrant.d'), 'insecure_private_key')
Vagrant.configure('2') do |c|
c.ssh.insert_key = false
c.vm.box = "centos/7"