Created
February 1, 2013 00:10
-
-
Save kitplummer/4687936 to your computer and use it in GitHub Desktop.
initialize openstack instance.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f /root/.initialized ]; then | |
exit 0 | |
fi | |
FQDN=`/usr/bin/curl -s http://169.254.169.254/latest/user-data | grep hostname | sed 's/.*=//' | sed 's/ //'` | |
HOSTNAME=`echo ${FQDN} | awk -F"." '{print $1}'` | |
PM=`/usr/bin/curl -s http://169.254.169.254/latest/user-data | grep puppetmaster | sed 's/.*=//' | sed 's/ //'` | |
if [ "$FQDN" == "" ]; then | |
echo "No hostname found in user metadata" | |
exit 0 | |
fi | |
echo $FQDN > /etc/hostname | |
hostname $FQDN | |
echo "PM: $PM" | |
echo "server=$PM" >> /etc/puppet/puppet.conf | |
echo "listen=true" >> /etc/puppet/puppet.conf | |
echo "127.0.0.1 localhost $HOSTNAME $FQDN" > /etc/hosts | |
sed -ie '$d' /etc/ddclient.conf | |
echo "$HOSTNAME" >> /etc/ddclient.conf | |
#/usr/sbin/ddclient -foreground -ip `curl http://169.254.169.254/latest/meta-data/public-ipv4` | |
rm -rf /etc/puppet/ssl | |
puppet agent --waitforcert 60 --server puppet --test --no-daemonize | |
#touch /root/.initialized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script will be executed *after* all the other init scripts. | |
# You can put your own initialization stuff in here if you don't | |
# want to do the full Sys V style init stuff. | |
touch /var/lock/subsys/local | |
sh /root/initialized.sh | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment