Skip to content

Instantly share code, notes, and snippets.

View ryancragun's full-sized avatar

Ryan Cragun ryancragun

View GitHub Profile
#!/usr/bin/env bash
# A hacky fixer for copyloopvar errors
go install github.com/karamaru-alpha/copyloopvar/cmd/copyloopvar@latest
cmd="sed"
if uname -s | grep Darwin; then
cmd="gsed"
fi

Keybase proof

I hereby claim:

  • I am ryancragun on github.
  • I am ryancragun (https://keybase.io/ryancragun) on keybase.
  • I have a public key ASDZWnLbo07D2SwnbuOe0GNrZuzf7vhNT78W8Zq7f257hQo

To claim this, I am signing this object:

Chef Server HA and DRBD Split Brain Recovery

The default recovery settings for DRBD on the Chef Server will take care of split brain scenarios most of the time. The following are steps that you can take to manually recover a split brain. Before following any of the steps read the entire document through completely.

Determine the cluster health

The Chef Server ships with helper commands to determine the current ha-status of the Server. DRBD ships with utilities to determine and control the state DRBD. First you'll want to check the DRBD status and ha-status of both backend nodes and determine which steps you'll need to take for remediation.

Determine the HA status

$: chef-server-ctl ha-status

Mapping Nodes to Organizations

Chef 11.x

You'll need to run this on the Server in Orgmapper, eg:

/opt/opscode/bin/orgmapper
orgmapper>> eval(::File.read("/path/to/code.rb"))
@ryancragun
ryancragun / gist:9744804
Created March 24, 2014 17:18
Amazon Linux RightLink install
#!/usr/bin/env sh
# import RightScale key
curl -Ss 'https://s3.amazonaws.com/rightscale_key_pub/rightscale_key.pub' > /etc/pki/rpm-gpg/RPM-GPG-KEY-rightscale
gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-rightscale
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rightscale
# add Epel repo
cat >/etc/yum.repos.d/Epel.repo<<-'EOF'
[epel-mirror]
@ryancragun
ryancragun / create_monolithic_repo
Created August 29, 2013 18:12
Create monolithic chef repo that mirrors previous repo path overrides
#!/usr/bin/env bash
# Create monolithic git repo that mirrors previous override structure
#create temp dir
temp_dir=/tmp/chef
mkdir $temp_dir
cd $temp_dir
#check out cookbooks
git clone https://github.com/rightscale/rightscale_cookbooks rightscale_cookbooks_upstream
@ryancragun
ryancragun / gist:6224188
Created August 13, 2013 18:34
rest_connection / updated EIP from CLI
#/usr/bin/env ruby
require 'rubygems'
require 'rest_connection'
# This script will parse two command line arguments: Server Name and EIP Name
# It will then change the EIP of the given Server to the EIP.
# ryan @ rightscale.com
server, eip = ARGV[0], ARGV[1]
@ryancragun
ryancragun / gist:4238202
Last active October 13, 2015 18:28
add new user
#!/usr/bin/env ruby
# provisions a user and sets permissions
# [email protected]
require 'rubygems'
require 'right_api_client'
require 'highline/import'
raise "right_api_client version 1.5.9 is required for this script" unless Gem.loaded_specs['right_api_client'].version.to_s == "1.5.9"
@ryancragun
ryancragun / gist:955661
Created May 4, 2011 17:56
set hostname db from metadata
<?php
$METADATA = file("/var/spool/ec2/meta-data-cache.sh");
foreach ($METADATA as $line) {
$data = explode ('=',$line);
switch ($data[0]) {
case "export EC2_HOSTNAME":
$hostname_DB = $data[1];
break;
}
set nocompatible
set expandtab
set tabstop=2
set shiftwidth=2
set noautoindent
set smartindent
set incsearch
set ruler
set number
set showmatch