Skip to content

Instantly share code, notes, and snippets.

@tfhartmann
Last active December 20, 2015 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfhartmann/6185332 to your computer and use it in GitHub Desktop.
Save tfhartmann/6185332 to your computer and use it in GitHub Desktop.
POC Notes for Puppet

Put this in it's own deployment repo (branchs for differt types of server i.e. front end, app server etc)

https://github.com/huit/puppet-mediawiki

Needs a patch for db_server param in the puppet-mediawiki module

4 basic files

  1. "yamilifier" script that pulls env vars into hierra
  2. single shell script with standard name (bootstrap.sh)
  3. Puppetfile
  4. init.pp or X number of of manifests

Things to add to the dev box

  1. Cron job that runs puppet in noop mode and emails the dev any changes it would have made (safetynet)
@hakamadare
Copy link

so, this is totally a hack, but it'll do for an env-to-yaml extractor:

#!/usr/bin/ruby

require 'yaml'

# parse args to determine env var prefix
default_prefix = 'NEPHO_'
prefix = default_prefix
ARGV.each_with_index {|arg, i| arg =~ /^(-p|--prefix)$/ && prefix = ARGV[i + 1]}
prefix || prefix = default_prefix

# extract env vars matching prefix and put them in a hash
extracted = {}
ENV.select {|key, value| key =~ /^#{prefix}/}.each {|pair| extracted[pair[0]] = pair[1]}

# emit the hash
puts extracted.to_yaml

@hakamadare
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment