rhel64_x86_64
Red Hat 6.4 x86_64 template
RHEL-6
3
x86_64
CHANGEME
file:///home/sgordon/Downloads/RHEL6.3-20120613.2-Server-x86_64-DVD1.iso
sed -i 's/ rhgb//g' /boot/grub/grub.conf
sed -i 's/ quiet//g' /boot/grub/grub.conf
sed -i '/^HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth0
echo -n > /etc/udev/rules.d/70-persistent-net.rules
echo -n > /lib/udev/rules.d/75-persistent-net-generator.rules
cat >> /etc/rc.local << EOF
if [ ! -d /root/.ssh ]; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
ATTEMPTS=30
FAILED=0
while [ ! -f /root/.ssh/authorized_keys ]; do
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
if [ \$? -eq 0 ]; then
cat /tmp/metadata-key >> /root/.ssh/authorized_keys
chmod 0600 /root/.ssh/authorized_keys
restorecon /root/.ssh/authorized_keys
rm -f /tmp/metadata-key
echo "Successfully retrieved public key from instance metadata"
echo "*****************"
echo "AUTHORIZED KEYS"
echo "*****************"
cat /root/.ssh/authorized_keys
echo "*****************"
curl -f http://169.254.169.254/latest/meta-data/hostname > /tmp/metadata-hostname 2>/dev/null
if [ \$? -eq 0 ]; then
TEMP_HOST=\$(cat /tmp/metadata-hostname)
sed -i "s/^HOSTNAME=.*\$/HOSTNAME=\$TEMP_HOST/g" /etc/sysconfig/network
/bin/hostname \$TEMP_HOST
echo "Successfully retrieved hostname from instance metadata"
echo "*****************"
echo "HOSTNAME CONFIG"
echo "*****************"
cat /etc/sysconfig/network
echo "*****************"
else
echo "Failed to retrieve hostname from instance metadata. This is a soft error so we'll continue"
fi
rm -f /tmp/metadata-hostname
else
FAILED=\$((\$FAILED + 1))
if [ \$FAILED -ge \$ATTEMPTS ]; then
echo "Failed to retrieve public key from instance metadata after \$FAILED attempts, quitting"
break
fi
echo "Could not retrieve public key from instance metadata (attempt #\$FAILED/\$ATTEMPTS), retrying in 5 seconds..."
sleep 5
fi
done
EOF