Sha256: 2c42036c4ba65dc5ff251dec4399289ae08a42e0b13c23de560588fc91720042

Contents?: true

Size: 1.91 KB

Versions: 3

Compression:

Stored size: 1.91 KB

Contents

function install_chef {

CODENAME=$(cat /etc/*release | grep CODENAME | sed -e "s|^.*=\([^$]*\)$|\1|")
local INSTALL_TYPE=${1:-"CLIENT"} # CLIENT/SERVER

local CDN_BASE="http://c2521002.cdn.cloudfiles.rackspacecloud.com"
local TARBALL="chef-client-0.9.16-ubuntu.10.10-x86_64.tar.gz"

if [[ "$CODENAME" == "lucid" ]]; then
	if [[ "$INSTALL_TYPE" == "SERVER" ]]; then
		TARBALL="chef-server-0.9.16-ubuntu.10.04-x86_64.tar.gz"
	else
		TARBALL="chef-client-0.9.16-ubuntu.10.04-x86_64.tar.gz"
	fi
elif [[ "$CODENAME" == "maverick" ]]; then
	if [[ "$INSTALL_TYPE" == "SERVER" ]]; then
		TARBALL="chef-server-0.9.16-ubuntu.10.10-x86_64.tar.gz"
	else
		TARBALL="chef-client-0.9.16-ubuntu.10.10-x86_64.tar.gz"
	fi
else
	echo "Only Ubuntu 10.04 and 10.10 are supported Chef clients."; exit 1;
fi

apt-get update &> /dev/null || { echo "Failed to apt-get update."; exit 1; }
dpkg -L rsync &> /dev/null || apt-get install -y rsync &> /dev/null

if ! dpkg -L chef &> /dev/null; then

    local CHEF_PACKAGES_DIR=$(mktemp -d)

    wget "$CDN_BASE/$TARBALL" -O "$CHEF_PACKAGES_DIR/chef.tar.gz" &> /dev/null \
        || { echo "Failed to download Chef RPM tarball."; exit 1; }
	cd $CHEF_PACKAGES_DIR
	tar xzf chef.tar.gz || { echo "Failed to extract Chef tarball."; exit 1; }
	rm chef.tar.gz

	echo "chef-solr    chef-solr/amqp_password    password  YA1B2C301234Z" | debconf-set-selections &> /dev/null || { echo "Failed to set debconf selections for chef-solr."; exit 1; }
	echo "chef    chef/chef_server_url    string  http://localhost:4000" | debconf-set-selections &> /dev/null || { echo "Failed to set debconf selections for chef."; exit 1; }
	DEBIAN_FRONTEND=noninteractive dpkg -i -R chef* &> /dev/null || { echo "Failed to install the Chef Server via apt-get on $HOSTNAME."; exit 1; }

	cd /tmp
	rm -Rf $CHEF_PACKAGES_DIR

	/etc/init.d/chef-client stop &> /dev/null
	sleep 2
	kill -9 $(pgrep chef-client) &> /dev/null || true
	rm /var/log/chef/client.log

fi

}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chef-vpc-toolkit-2.6.1 lib/chef-vpc-toolkit/chef_bootstrap/ubuntu.bash
chef-vpc-toolkit-2.6.0 lib/chef-vpc-toolkit/chef_bootstrap/ubuntu.bash
chef-vpc-toolkit-2.5.2 lib/chef-vpc-toolkit/chef_bootstrap/ubuntu.bash