Last active
August 29, 2015 13:56
-
-
Save hoegertn/9296992 to your computer and use it in GitHub Desktop.
Install CloudConductor-Agent
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 | |
# USERDATA | |
# $CLOUDCONDUCTOR_URL=host:port | |
# $TEMPLATE_NAME=name of the template to use | |
yum -y update | |
# EPEL repo | |
rpm -ivh http://ftp.tu-chemnitz.de/pub/linux/fedora-epel/6/i386/epel-release-6-8.noarch.rpm | |
yum -y clean all | |
yum -y update | |
yum -y install bash-completion vim wget python-magic | |
# Security | |
chkconfig iptables off | |
chkconfig ip6tables off | |
service iptables stop | |
service ip6tables stop | |
echo "SELINUX=disabled" > /etc/sysconfig/selinux | |
# Install java | |
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm" -O /root/jdk-7u51-linux-x64.rpm --no-check-certificate | |
rpm -Uvh /root/jdk-7u51-linux-x64.rpm | |
rm -rf /root/jdk-7u51-linux-x64.rpm | |
# Add CloudConductor repo and install agent | |
wget -O /etc/yum.repos.d/cloudconductor.repo http://yum.cloudconductor.net/cloudconductor.repo | |
yum -y clean all | |
yum -y install cloudconductor-agent | |
# modify env.sh for EC2 | |
cat > /opt/cloudconductor-agent/env.sh << "EOF" | |
#!/bin/bash | |
BASE=http://169.254.169.254/latest/meta-data/ | |
export INSTANCE_ID=`curl $BASE/instance-id` | |
export INSTANCE_TYPE=`curl $BASE/instance-type` | |
export AMI_ID=`curl $BASE/ami-id` | |
export PUBLIC_HOSTNAME=`curl $BASE/public-hostname` | |
export AZ_INFO=`curl $BASE/placement/availability-zone` | |
USER_DATA=`curl -f http://169.254.169.254/latest/user-data | tr -d '\r'` | |
IFS=$'\n'; | |
for line in $USER_DATA; | |
do | |
export $line; | |
done; | |
unset IFS; | |
EOF | |
service cloudconductor-agent start | |
# drop local ssh-keys and activate auto-load | |
touch /root/firstrun | |
rm -f /root/.ssh/authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment