Skip to content

Instantly share code, notes, and snippets.

@hedgehog
Created December 17, 2010 00:25
Show Gist options
  • Select an option

  • Save hedgehog/744276 to your computer and use it in GitHub Desktop.

Select an option

Save hedgehog/744276 to your computer and use it in GitHub Desktop.
#!/bin/bash
HOSTNAME=<%= @node_name %>
echo "Take one: $CHEF_NODE_NAME"
echo "Take two: $HOSTNAME"
DOMAIN=taqtik.com
hostname $HOSTNAME
echo $HOSTNAME> /etc/hostname
IPADDR=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
echo $IPADDR >/tmp/ip_current
sed -i "s/127.0.0.1[[:space:]]localhost/127.0.0.1 localhost\n$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME\n/g" /etc/hosts
sed -i "s/127.0.1.1[[:space:]]vagrantup.com[[:space:]]vagrantup/$IPADDR $HOSTNAME.$DOMAIN $HOSTNAME\n/g" /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment