Skip to content

Instantly share code, notes, and snippets.

@hosh
Created April 30, 2010 20:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hosh/385718 to your computer and use it in GitHub Desktop.
Save hosh/385718 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Configuration
#CLOUD_ETH="eth0"
CLOUD_ETH="eth1" # Standard for Rackspace Cloud
CHEFSERVER="10.177.133.40"
# Do not edit below
NODE=`dd if=/dev/urandom count=1 2> /dev/null | md5sum | head -n 2 | tail -n 1 | cut -c-26`
NODE_NAME="node-${NODE}"
IP=`ifconfig ${CLOUD_ETH} | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo "BOOTSTRAP: I am ${NODE_NAME}"
echo "HOSTNAME=\"${NODE_NAME}\"" > /etc/conf.d/hostname
echo "" >> /etc/hosts
echo "${IP} ${NODE_NAME}" >> /etc/hosts
echo "${CHEFSERVER} bork chef-server" >> /etc/hosts
/etc/init.d/hostname restart
echo `hostname -f`
cat /etc/hosts
rm -f /etc/chef/client.pem
chef-client -V
/etc/init.d/chef-client start
rc-update add chef-client default
rm -f /etc/conf.d/bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment