Last active
May 18, 2016 17:18
-
-
Save ajayhn/98c7c913b48dd2bdcc41 to your computer and use it in GitHub Desktop.
all-in-one-openstack-trusty-mainline
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 | |
# E.g. (OPENSTACK=juno CONTRAIL=R2.20 BUILD=102-juno bash -x all-in-one-openstack-trusty-mainline) | |
set -x | |
# Inputs from user with defaults | |
OPENSTACK=${OPENSTACK:-juno} | |
CONTRAIL=${CONTRAIL:-mainline} | |
BUILD=${BUILD} | |
VROUTER_INTF=${VROUTER_INTF:-eth0} | |
# Point to apt repo + update | |
echo "deb http://hajay-repo:8080/${OPENSTACK}-${CONTRAIL}-${BUILD}/ opencontrail-${CONTRAIL} main" > /etc/apt/sources.list.d/opencontrail.list | |
apt-get update | |
# Create a key for access w/o password *WARNING* overwrites any id_rsa key present | |
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa | |
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | |
# Get fabric + utilities | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated fabric contrail-fabric-utils python-netaddr | |
echo "127.0.0.1 $(hostname)" >> /etc/hosts | |
# Craft testbed | |
cp /opt/contrail/utils/fabfile/testbeds/testbed_singlebox_example.py /opt/contrail/utils/fabfile/testbeds/testbed.py | |
sed -i 's/1.1.1.1/127.0.0.1/g' /opt/contrail/utils/fabfile/testbeds/testbed.py | |
VROUTER_IP=$(ifconfig ${VROUTER_INTF} | grep "inet addr" | awk '{ print $2 }' | cut -f 2 -d ':') | |
sed -i "s/host1 = 'root@127.0.0.1'/&\nhost1_compute = 'root@"${VROUTER_IP}"'/" /opt/contrail/utils/fabfile/testbeds/testbed.py | |
sed -i "s/ 'compute': \[host1\],/ 'compute': \[host1_compute\],/" /opt/contrail/utils/fabfile/testbeds/testbed.py | |
# Pin version of nodejs needed by webui | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated nodejs=0.8.15-1contrail1 | |
# At some point there is a pin on keepalived :( | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated keepalived=1.2.13-0~276~ubuntu14.04.1 | |
# Install contrail packages | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack | |
cd /opt/contrail/utils && fab install_ceilometer | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-database | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-config | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-analytics | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-webui | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-control | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated contrail-openstack-vrouter | |
# Configure to work in a 'thin' system | |
cat << EOF >> /opt/contrail/utils/fabfile/testbeds/testbed.py | |
env.openstack = { | |
'osapi_compute_workers' : 1, | |
'conductor_workers' : 1, | |
} | |
EOF | |
echo "minimum_diskGB = 2" >> /opt/contrail/utils/fabfile/testbeds/testbed.py | |
# fab setup_all seems to be starting neutron before setting port | |
# causing conflict with haproxy. so set port here itself | |
openstack-config --set /etc/neutron/neutron.conf DEFAULT bind_port 9697 | |
# Provision the system | |
cd /opt/contrail/utils && fab setup_all:reboot='False' | |
# Disable cloud-init | |
for x in $(ls /etc/init/cloud*.conf); do echo manual >> $(echo $x | sed 's/\.conf/\.override/'); done | |
## Bring firstboot files | |
#curl https://raw.githubusercontent.com/ajayhn/userdata-scripts/master/raw/firstboot_controller.sh > /etc/contrail/firstboot_controller.sh | |
#curl https://raw.githubusercontent.com/ajayhn/userdata-scripts/master/raw/firstboot_compute.sh > /etc/contrail/firstboot_compute.sh | |
#chmod a+x /etc/contrail/firstboot_controller.sh | |
#chmod a+x /etc/contrail/firstboot_compute.sh | |
#echo "reboot" >> /etc/contrail/firstboot_compute.sh | |
#echo "reboot" >> /etc/contrail/firstboot_controller.sh | |
## Need to run compute fixup first since controller relies on metadata service accessible for hostname | |
#sed -i 's#^exit 0#\(/etc/contrail/firstboot_compute.sh\n/etc/contrail/firstboot_controller.sh)\n&#' /etc/rc.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment