Skip to content

Instantly share code, notes, and snippets.

@bleach
bleach / gist:1394056
Created November 25, 2011 17:45
Ubuntu popularity contest: Puppet vs Chef
$ wget -qc http://popcon.ubuntu.com/by_vote
$ egrep '^(#rank|[[:digit:]]+[[:space:]]+(puppet|chef)[[:space:]])' by_vote
#rank name inst vote old recent no-files (maintainer)
6663 puppet 3426 276 2863 287 0 (Puppet Package Maintainers)
11706 chef 195 58 134 2 1 (Unknown)
@bleach
bleach / puppet.md
Last active June 2, 2016 12:57
How I manage my dot files

Here's how I solve the age old problem of getting my configuration files onto multiple machines.

I have a private git repo containing puppet manifests. I keep it separate from any other puppet configuration for two reasons:

  • I want to use it on personal machines without copying work data around to other machines
  • I don't want to worry about my personal puppet stuff breaking puppet runs

Here's an example node definition for my development VMs at songkick:

node /^of1-dev-graham(-lucid)?$/ {
@bleach
bleach / newrunner.md
Last active December 10, 2015 13:59
Someone asked what a sensible kit list was for a new runner, this is my answer.

Running is a simple sport and you don't need much kit to go running in some comfort.

That doesn't stop people trying to sell you stuff; GPS watches, heart rate monitors, phone carriers, flashing armbands, massaging foam rollers etc. are things you might want to buy later, if you feel that you're enjoying running and need them. I have some of them, I don't use them very often.

This is what, in my opinion, you need to go running.

Running shoes

There's only one way to get a decent pair of running shoes; try them on. The easiest way is to go to a decent running shop, where they'll actually watch what your feet do when you run and then sell you an (expensive) pair of running shoes suitable for you.

@bleach
bleach / HostnameTest
Created April 19, 2013 06:34
jruby gethostname implementation
import java.net.InetAddress;
import java.net.UnknownHostException;
public class HostnameTest {
public static void main(String[] args) {
try {
System.out.println(InetAddress.getByAddress(new byte[]{0,0,0,0}).getHostName());
} catch (UnknownHostException e2) {
System.out.println("Caught UnknownHostException");
@bleach
bleach / 1description.md
Last active December 16, 2015 12:49
How I manage users with ssh keys in puppet (simplified)
  • We have a define called company_user which (amongst other things) calls ssh_authorized_key to create their ssh key
  • In the common case (one ssh key) I just have one company_user resource for the user.
  • If people have additional ssh keys we call ssh_authorized_key for each additional ssh key
mod 'puppetlabs/haproxy', '0.3.0'
mod 'puppetlabs/puppetdb', '1.1.4'
mod 'puppetlabs/stdlib', '3.2.0'
@bleach
bleach / gist:6089508
Created July 26, 2013 14:54
Release note/changelog generator. Run this before pushing to origin. Needs the git completion function. Tested on bash.
alias GITRELEASE='b=$(__git_ps1 "%s"); git log --reverse --format='%s' "origin/${b}..${b}" | sed -e "s/^/- /"'
@bleach
bleach / output
Last active December 22, 2015 11:28
This lives on our git server as /usr/local/bin/git and advises people where they went wrong when creating a new repo.
$ git init
________________________________________
/ Friends don't let friends run git init \
\ without --shared /
----------------------------------------
\ . .
\ / `. .' "
\ .---. < > < > .---.
\ | \ \ - ~ ~ - / / |
_____ ..-~ ~-..-~
@bleach
bleach / cowsay_motd.erb
Created October 2, 2013 12:15
Cowsay motd. cowsay must be installed on the puppetmaster
<%= %x{/usr/games/cowsay -f #{cowfile} #{message}} %>

What we did

Ran a simple pipeline in a vagrant concourse-lite machine, consisting of:

  • a S3 resource pointing at a bucket
  • a job with a get step referencing that resource

What we learned

When we run the pipeline for the first time, the S3 bucket did not exist: