Skip to content

Instantly share code, notes, and snippets.

View lusis's full-sized avatar

John E. Vincent lusis

View GitHub Profile
import argparse
from mock import Mock
m = Mock()
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
query_group = subparsers.add_parser('query')
add_group = subparsers.add_parser('add')
lusis / cloudstack-centos6.conf
Created March 24, 2012 05:04
fairly unsafe cloudstack upstart script to set hostname
# cloudstack - Changes hostname
# changes hostname to match cloudstack instance name
# centos version (tested on CentOS 6)
description "Changes hostname"
start on started network
# Do a bunch of shit that should only happen at initial setup
# file: cookbooks/foo/recipes/bootstrap.rb
# initial runlist role[foo],recipe[foo::bootstrap]
# useful for downloading an initial codebase of an application
# as opposed to attempting to reinstall each time
ruby_block "remove_bootstrap_recipe" do
block do"Removing foo boostrap from runlist")
node.run_list.remove("recipe[foo::bootstrap]") if node.run_list.include?("recipe[foo::bootstrap]")
lusis / dba-user.json
Created January 7, 2011 11:24
Managing MySQL user accounts with Chef
"comment":"DBA User",
"groups": [
"ssh_key": "XXXXXXXXXX"
# run with
# chef-apply chef-rundeck.rb
require 'chef'
require 'chef/node'
require 'chef/mixin/xml_escape'
require 'chef/rest'
require 'chef/role'
require 'chef/environment'
require 'chef/data_bag'
package fooservice
import (
idgen ""
pb ""
storer ""
lusis / iam-s3-policy.json
Created January 5, 2011 10:32
A sample AWS IAM json policy file with read-only access to certain S3 buckets
lusis /
Created February 26, 2013 05:17
Generate system packages with FPM as part of maven.
#!/usr/bin/env bash
if [ -z ${CURRENT_ITERATION} ]; then
case "${PKG_VERSION}" in
echo "Packaging a snapshot version!"
#CURRENT_SHA=`git rev-parse HEAD`
lusis /
Last active September 14, 2020 17:47
terraform template to generate serverspec properties

This uses terraform's template_file resource to generate a yaml properties file for serverspec to use.

  • create the Rakefile in your terraform project root
  • create a spec directory and put spec_helper.rb in it
  • create the templates/properties.tmpl.yml file
  • create the
  • terraform apply


Tests will be matched based on roles defined for a given node.

lusis / keytool.rb
Created March 26, 2012 04:51
recipe for adding certs to keytool
keystore = "/etc/java-6-sun/security/cacerts"
keystore_pass = "foobar"
# you'll need foo.cert et. al. in files/default
certs = %w{foo bar bang}
certs.each do |cert|
cookbook_file "#{Chef::Config[:file_cache_path]}/#{cert}.cert" do
source "#{cert}.cert"