Skip to content

Instantly share code, notes, and snippets.

@stefhen
stefhen / migrate.txt
Created June 14, 2016 18:38
Migrage Chef Client from old Chef Server to new Chef Server
http://stackoverflow.com/questions/28806585/how-to-migrate-from-one-chef-server-to-another-chef-server
There are multiple steps here and some information is needed from you to better answer your question.
Assumptions
Your nodes are Linux nodes and you are still working in the Chef 11 version.
Your new chef server has all of the cookbooks, roles, data bags and environments moved over from your old chef server.
Steps
@stefhen
stefhen / docker-sleep.txt
Last active January 11, 2023 18:52
Docker container sleep forever
CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
#! /usr/bin/sudo /bin/bash
set -x
set -e
# https://github.com/berkshelf/berkshelf-api/issues/112
export LC_CTYPE=en_US.UTF-8
if [ ! -e /usr/bin/chef-client ]; then
curl -L https://www.opscode.com/chef/install.sh | sudo bash
name "stefhen-standalone"
rs_ca_ver 20131202
short_description "Stefhen Tagging Test"
long_description "Stefhen Tagging Test long"
parameter "security_groups" do
label "security_groups"
type "string"
end
"AWS AP-Singapore" "/api/clouds/4"
"AWS AP-Sydney" "/api/clouds/8"
"AWS AP-Tokyo" "/api/clouds/5"
"AWS China-Beijing" "/api/clouds/10"
"AWS EU-Frankfurt" "/api/clouds/9"
"AWS EU-Ireland" "/api/clouds/2"
"AWS SA-São Paulo" "/api/clouds/7"
"AWS US-East" "/api/clouds/1"
"AWS US-Oregon" "/api/clouds/6"
"AWS US-West" "/api/clouds/3"
@stefhen
stefhen / create-aws-console-user.sh
Last active December 1, 2015 17:26
Create AWS console user from the awscli
#!/bin/bash
# USAGE: ./create-aws-console-user.sh $GROUPNAME $USERNAME $PASSWORD
# http://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_cliwpsapi
# Create administrator group
aws iam create-group --group-name $1
@stefhen
stefhen / cassandra_tag.rb
Last active October 21, 2015 21:20
machine_tag search example
include_recipe "machine_tag::default"
# Tag host with seed status
machine_tag "cassandra:seed_host=#{node[:cassandra][:is_seed_host]}" do
action :create
end
# Tag host with broadcast and listen addresses for discovery
machine_tag "cassandra:broadcast_address=#{node[:cassandra][:broadcast_address]}" do
action :create
@stefhen
stefhen / examples.md
Last active August 29, 2015 14:27
AWS JSON Query Examples
  • List all IP's and ssh keys
aws --region us-west-2 ec2 describe-instances --query \
'Reservations[].Instances[].[PublicIpAddress,KeyName]'

---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@stefhen
stefhen / bootstrap.sh
Last active August 29, 2015 14:24
Base Package Install List
#!/bin/bash
# from build-essential::_debian
sudo apt-get -y install autoconf binutils-doc bison flex gettext ncurses-dev
# utils from build-essential::_debian
sudo apt-get -y install curl vim
kernel=`uname -r`
sudo apt-get -y install linux-image-$kernel