Skip to content

Instantly share code, notes, and snippets.

View double-z's full-sized avatar

Zack Zondlo double-z

View GitHub Profile
@double-z
double-z / secret.rb
Created February 26, 2016 01:50 — forked from sethvargo/secret.rb
Example Chef extension to extract secrets from HashiCorp's Vault
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@double-z
double-z / _service.md
Created February 7, 2016 21:46 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@double-z
double-z / ubuntu-1404-preseed
Created February 5, 2016 23:24 — forked from scottslowe/ubuntu-1404-preseed
This is a preseed file, written for Ubuntu Server 14.04.2, that provides a fully automated installation (assuming the presence of a PXE boot infrastructure and a local HTTP server to provide the installation files).
# Ubuntu Server automated installation
# by Scott Lowe ([email protected])
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i netcfg/choose_interface select eth0
d-i netcfg/get_hostname string hostname
d-i netcfg/get_domain string domain.com
d-i netcfg/wireless_wep string
@double-z
double-z / cleanup_bifrost.rb
Created December 22, 2015 17:28
Script For Cleaning Up invalid users and clients in Bifrost DB
require 'pg'
add_command_under_category "cleanup-bifrost", "cleanup", "Cleanup orphaned bifrost objects.", 2 do
erchef_db = setup_erchef_db
bifrost_db = setup_bifrost_db
puts "Populating hash of valid clients and users."
clients_and_users = erchef_db.exec_params("SELECT authz_id FROM clients UNION select authz_id FROM users")
real_actor_list = []
clients_and_users.each do |real_actor|
@double-z
double-z / cluster.rb
Last active August 29, 2015 14:26 — forked from mwrock/cluster.rb
chef-provisioning cluster provider
use_inline_resources
require 'json'
include ClcLibrary::Helper
include Provisioner::Helper
def whyrun_supported?
true
end
@double-z
double-z / consul-register.sh
Created April 21, 2015 16:42
Register with Chef-Provisioning-Registry via consul
#!/bin/bash
MACHINE_TYPE=$1
USER_NAME='provisioner'
USER_HOME="/home/$USER_NAME"
if [ -d $USER_HOME ]
then
echo "ALREADY REGISTERED"
else
require 'chef/provisioning'
chef_gem 'chef-provisioning-vagrant'
count = ['one', 'two']
count.each do |nc|
machine "vweb-#{nc}" do
action [:ready, :setup, :converge]
driver 'vagrant'
@double-z
double-z / gist:fbeb142c0c16eb5b2a15
Created March 31, 2015 23:22
vagrant-provisioning-hosted-chef-server
chef_gem 'chef-provisioning-vagrant'
with_chef_server "https://api.opscode.com/organizations/zzondlo",
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]
machine "vweb" do
action [:ready, :setup, :converge]
driver 'vagrant'
machine_options :vagrant_options => {
@double-z
double-z / gist:6ab698da400972534657
Created March 4, 2015 06:35
chef-provisioning-ssh with winrm support
with_driver 'ssh'
with_chef_server "https://api.opscode.com/organizations/double-z",
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]
machine "winone" do
action [:ready, :setup, :converge]
machine_options :transport_options => {
'is_windows' => true,
@double-z
double-z / chef_bootstrap_insert_chef_config_attr.erb
Created February 12, 2015 23:36
Insert a `chef_config` attr into a bootstrap erb
cat > /etc/chef/user.pem <<'EOP'
<%= IO.read(File.expand_path(@chef_config[:client_key])) %>
EOP
chmod 0600 /etc/chef/user.pem