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="eth1" # Standard for Rackspace Cloud
# 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 "${IP} ${NODE_NAME}" >> /etc/hosts
/etc/init.d/hostname restart
echo `hostname -f`
rm -f /etc/chef/client.pem
chef-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment