Skip to content

Instantly share code, notes, and snippets.

View ryancragun's full-sized avatar

Ryan Cragun ryancragun

View GitHub Profile
12:26:15: Starting Chef Solo Run
12:26:17: Replacing the run_list with ["right_scripts_cookbook::SYS_Timezone_set___11H1", "right_scripts_cookbook::SYS_Syslog_remote_logging_client___11H1", "right_scripts_cookbook::MAIL_Postfix_local_delivery___11H1", "right_scripts_cookbook::SYS_Monitoring_install___11H1"] from JSON
*ERROR> Chef converge failed
*ERROR> An error occurred during the execution of Chef. The error message was:
uninitialized constant Chef::Node::Opscode
The error occurred line 20 of [COOKBOOKS]//1/mysql/attributes/server.rb in method 'from_file' while executing:
18 #
@ryancragun
ryancragun / gist:922133
Created April 15, 2011 17:55
remove password auth
#!/bin/bash -e
# Ryan C.
# Disable SSH password auth
if [ $RS_DISTRO = ubuntu ]; then
ssh="ssh"
elif [ $RS_DISTRO = centos ]; then
ssh="sshd"
fi
set nocompatible
set expandtab
set tabstop=2
set shiftwidth=2
set noautoindent
set smartindent
set incsearch
set ruler
set number
set showmatch
@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;
}
@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: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 / 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: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]

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"))

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