Skip to content

Instantly share code, notes, and snippets.

@metaxis
Forked from botchagalupe/gist:721028
Created December 6, 2010 04:32
Show Gist options
  • Save metaxis/729867 to your computer and use it in GitHub Desktop.
Save metaxis/729867 to your computer and use it in GitHub Desktop.
student knife workstation setup

Setup a Student Chef Client on Ubuntu

ssh ubuntu@<IP Supplied by the Instructor>  (password opstrain_0150)

mkdir -p ~/chef-repo/.chef

From your Client box copy your Key and config files

scp *.pem ubuntu@ec2-?????.com:~
scp .pem ubuntu@ec2-?????.com:~
scp knife.rb ubuntu@ec2-?????.com:~

ssh ubuntu@ec2-?????.com
mv USERNAME.pem ORGANIZATION-validator.pem knife.rb ~/chef-repo/.chef

_ Create and run Chef Client Boot Script_

sudo su -
if [ ! -f /usr/bin/chef-client ]; then
  apt-get update
  apt-get install -y ruby ruby1.8-dev build-essential wget libruby-extras libruby1.8-extras
  cd /tmp
  wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
  tar zxf rubygems-1.3.7.tgz
  cd rubygems-1.3.7
  ruby setup.rb --no-format-executable
fi

sudo gem install ohai chef --no-rdoc --no-ri --verbose

sudo apt-get -y install libxml2 libxml2-dev libxslt1-dev git-core

sudo gem install net-ssh net-ssh-multi fog highline --no-rdoc --no-ri --verbose

mkdir -p /etc/chef

Validate the install and setup

# stop being root
root@ip-10-130-34-86:~# logout
cd ~/chef-repo 

knife client list

Complete the Client install

Generate your Chef client configuration

cd ~/chef-repo
knife configure client ./client-config

You'll now have a client-config directory in your local repository:

ls -l client-config
-rw-r--r--   1 adam  staff   155 Jun 18 16:03 client.rb
-rw-r--r--@  1 adam  staff  1679 Jun 18 16:03 validation.pem

sudo cp ~/chef-repo/client-config/* /etc/chef

Run Chef for the first time

knife node list
[

]

Yep, we have no nodes.

Lets run Chef for the first time on your workstation, and it will create one for us:

sudo chef-client

[Fri, 18 Jun 2010 16:06:12 -0700] INFO: Running report handlers
[Fri, 18 Jun 2010 16:06:12 -0700] INFO: Report handlers complete

If we look now, we'll see your workstation is in the node list:

$ knife node list
[
  "latte"
]

To see all the data we collected about your node:

$ knife node show YOURNODE

In the output above, "latte" is my workstation. You should replace YOURNODE with whatever the name is you see when you run knife node list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment