Skip to content

Instantly share code, notes, and snippets.

@op-ct
op-ct / _el6_session.log
Created March 11, 2018 00:54
Simple test: does `rpmbuild` require single-digit days in `%changelog`?
[build_user@6d76bec03a81 ~]$ rpmlint -i foo.spec
foo.spec: W: no-buildroot-tag
The BuildRoot tag isn't used in your spec. It must be used in order to allow
building the package as non root on some systems. For some rpm versions (e.g.
rpm.org >= 4.6) the BuildRoot tag is not necessary in specfiles and is ignored
by rpmbuild; if your package is only going to be built with such rpm versions
you can ignore this warning.
0 packages and 1 specfiles checked; 0 errors, 1 warnings.
[build_user@6d76bec03a81 ~]$ rpm --version
@op-ct
op-ct / simp_ssh_vagrant.pp
Created March 5, 2018 19:09
Permit vagrant user to log into a stock SIMP SSH config
file{'/etc/ssh/local_keys/vagrant':
owner => 'vagrant',
group => 'vagrant',
mode => '0640',
source => 'file:///home/vagrant/.ssh/authorized_keys',
}
@op-ct
op-ct / results.md
Created January 24, 2018 16:52
Setting $server_facts using `let (:facts) {}`

Using PUPPET_VERSION='~> 4.10'

empty_class
  setting server_facts
    should contain Notify[servername-v85ix8blah.delivery.puppetlabs.net]

Finished in 0.13964 seconds (files took 0.82091 seconds to load)
1 example, 0 failures
@op-ct
op-ct / Vagrantfile
Created January 15, 2018 23:18
TPM2 Vagrantfile
config.vm.provision "shell", inline: <<-SHELL
export TPM2_SIM_VERSION=${TPM2_SIM_VERSION:-1119}
export TPM2_TOOLS_VERSION=${TPM2_TOOLS_VERSION:-3.0.2}
export TPM2_TSS_VERSION=${TPM2_TSS_VERSION:-1.3.0}
export TPM2_ABRMD_VERSION=${TPM2_ABRMD_VERSION:-1.2.0}
export TPM2_SIM_CMD_PORT=${TPM2_SIM_CMD_PORT:-2321}
export TPM2_SIM_PLATFORM_PORT=${TPM2_SIM_PLATFORM_PORT:-2322}
yum clean all
yum install -y git make autoconf autoconf-archive automake libtool gcc \
@op-ct
op-ct / puppet_beaker__gitlab_oauth_token__snippet.rb
Last active March 6, 2018 20:52
Beaker snippet: acquiring a GitLab 10.4+ oauth token using only the API + user creds
# Here is an example of how to grab a token under the new (10.0+ v4 API):
#
# It is written in the beaker DSL
require 'json'
# A puppet manifest to create a json file for the API query
oauth_json_pp= <<-PP
# passgen() is a simplib function
$pw = passgen( "simp_gitlab_${trusted['certname']}" )
@op-ct
op-ct / Vagrantfile
Created January 12, 2018 20:27
Vagrantfile to build SIMP using `rake beaker:suites[rpm_docker]`
# -*- mode: ruby -*-
# vi: set ft=ruby :
VM_CPUS = ENV['VAGRANT_VM_CPUS'] || '8'
Vagrant.configure('2') do |config|
# For a complete reference of configuration options, please see the online
# documentation at https://docs.vagrantup.com.
config.vm.box = 'centos/7'
config.vm.define ENV['VAGRANT_BOX_NAME'] || 'simp_builder'
@op-ct
op-ct / Dockerfile
Created January 11, 2018 20:22
EL7 TPM2.0 simulator + tpm2-tools
FROM centos:7
MAINTAINER [email protected]
# EL7-based container to run the TPM2.0 simulator and tpm2-tools
#
# inspired by:
# - https://github.com/starlab-io/docker-tpm2-emulator/blob/master/Dockerfile
# - https://github.com/starlab-io/docker-tpm-emulator/blob/master/Dockerfile
ARG TPM2_SIM_VERSION
@op-ct
op-ct / inotify-spec-standalone.sh
Created December 8, 2017 15:55
inotifywatch guard for Puppet module development
#!/bin/sh
# This is simple guard-away-from-Guard to continually run spec tests on a Puppet
# module as you save changes to existing files with vim. On most Linux OSes, it
# requires the `inotify-tools` package.
#
# NOTE: specific to existing files, vim, and the hard-coded paths/patterns below
files=($(find $PWD/{manifests,dist,templates,types,functions,spec/classes} \
-name \*.pp -o -name \*.epp -o -name \*.erb -o -name \*_spec.rb -name '*.conf'))
@op-ct
op-ct / rpm-gpg-query-notes.md
Created October 18, 2017 20:02
Query for GPG key ids for all RPMs

Query for GPG key ids for all RPMs

# from https://bugzilla.redhat.com/show_bug.cgi?id=846354#c1
rpm -qa --qf "%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{(none}|}| %{NVRA}\n"|cut -d' ' -f11,12
@op-ct
op-ct / puppetdb-discard-replace-facts.conf
Last active September 28, 2017 19:21
systemd-tmpfiles conf to clean up PE 2016.5.2 puppetdb "dead letter" files left by FACT-1732
# This ages off the ridiculous amount of dead letter files generated by
# PuppetDB when they are older than three days (as a result of FACT-1732)
#
# Place this in a file location like:
#
# /etc/tmpfiles.d/puppetdb-discard-replace-facts.conf
#
# See:
#
# * https://tickets.puppetlabs.com/browse/FACT-1732