Skip to content

Instantly share code, notes, and snippets.

@mehlah
Forked from woods/bootstrap_chef_server.sh
Created April 14, 2012 00:26
Show Gist options
  • Save mehlah/2381163 to your computer and use it in GitHub Desktop.
Save mehlah/2381163 to your computer and use it in GitHub Desktop.
Set up rackspace cloud server as chef server
#!/bin/bash
set -e # Exit on error
set -x # Print each command
apt-get install -y lsb-release
# Set up the OpsCode repository
echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list
gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
gpg --export packages@opscode.com | sudo tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
apt-get update
apt-get install opscode-keyring
# Make sure existing software is up to date
apt-get upgrade
# Install chef server
apt-get install chef chef-server
# chef_server_url: http://chef.westarete.com:4000
# set rabbitmq password
# set admin password
# Create a normal user account and switch to that
useradd -G sudo -c "Mehdi Lahmam B." -m mehlah
passwd mehlah
su - mehlah
# Install the required certificates for this user
mkdir -p ~/.chef
sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R mehlah ~/.chef
knife configure -i
# Overwrite /home/mehlah/.chef/knife.rb? (Y/N) y
# Please enter the chef server URL: [http://wert.westarete.com:4000]
# Please enter a clientname for the new client: [root] mehlah
# Please enter the existing admin clientname: [chef-webui]
# Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] /home/mehlah/.chef/webui.pem
# Please enter the validation clientname: [chef-validator]
# Please enter the location of the validation key: [/etc/chef/validation.pem] /home/mehlah/.chef/validation.pem
# Please enter the path to a chef repository (or leave blank):
# Creating initial API user...
# Created client[mehlah]
# Configuration file written to /home/mehlah/.chef/knife.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment