Skip to content

Instantly share code, notes, and snippets.

@tallgreentree
Created April 17, 2012 20:19
Show Gist options
  • Save tallgreentree/2408738 to your computer and use it in GitHub Desktop.
Save tallgreentree/2408738 to your computer and use it in GitHub Desktop.
Chef server bootstrap
#!/bin/bash
set -e # Exit on error
set -x # Print each command
# 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 | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg
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..com:4000
# set rabbitmq password
# set admin password
# Create a normal user account and switch to that
groupadd -g 23987 tallgreentree
useradd -u 23987 -g tallgreentree -G admin -c "Will Barrett" -m tallgreentree
passwd tallgreentree
su - tallgreentree
# Install the required certificates for this user
mkdir -p ~/.chef
sudo cp /etc/chef/validation.pem /etc/chef/webui.pem ~/.chef
sudo chown -R tallgreentree ~/.chef
# knife configure -i
# Overwrite /home/woods/.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] tallgreentree
# 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/woods/.chef/webui.pem
# Please enter the validation clientname: [chef-validator]
# Please enter the location of the validation key: [/etc/chef/validation.pem] /home/woods/.chef/validation.pem
# Please enter the path to a chef repository (or leave blank):
# Creating initial API user...
# Created client[woods]
# Configuration file written to /home/woods/.chef/knife.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment