Skip to content

Instantly share code, notes, and snippets.

@aliceh
Created September 3, 2014 21:59
Show Gist options
  • Save aliceh/f996dfbad4b115aaf60b to your computer and use it in GitHub Desktop.
Save aliceh/f996dfbad4b115aaf60b to your computer and use it in GitHub Desktop.
#!/bin/bash
local="/root"
echo
echo "Specify your deployment topology."
echo
echo "For more information visit https://eucalyptus.atlassian.net/wiki/display/QA/Eucalyptus+Configuration"
echo
printf "Select one of the following options \n 1) Proof of concept deployment (POC): \n Machine 1: CLC, SC, CC, Walrus, UI \n Machine 2: NC \n\n 2) Standard multicluster: \n Machine 1: CLC, SC, CC, Walrus \n Machine 2: SC1, CC1 \n Machine 3: NC \n Machine 4: NC1 \n "
read n
echo " You entered $n"
until [ $n -eq 1 -o $n -eq 2 ];
do
echo "Invalid option. Try again!"
printf "\n"
read n
done
if [ $n -eq 1 ];
then
printf "\n Please provide IP addresses of the machines for POC deployment."
echo
read -p "CLC: " clc_ip
read -p "Node: " node_ip
cat > $local/chef-repo/cookbooks/eucalyptus/bootstrap.json <<EOF
{
"nodes": [
{
"groups": ["cloud::full", "cloud::configure"],
"hosts": ["CLC_IP"]
},
{
"groups": ["node::default"],
"hosts": ["NODE_IP"]
}
]
}
EOF
pushd $local/chef-repo/cookbooks/eucalyptus
bootstrap="bootstrap.json"
sed -i "s/CLC_IP/$clc_ip/g" $bootstrap
sed -i "s/NODE_IP/$node_ip/g" $bootstrap
popd
elif [ $n == 2 ]; then
printf "\n Please provide IP addresses of the machines for Standard Multicludter deployment."
echo
read -p "Cluster 1: CLC, SC, CC, Walrus, UI " clc_ip
read -p "Cluster 2: SC, CC " cc_ip
read -p "Node 1: " node_1_ip
read -p "Node 2: " node_2_ip
cat > $local/chef-repo/cookbooks/eucalyptus/bootstrap.json <<EOF
{
"nodes": [
{
"groups": ["cloud::full", "cloud::configure"],
"hosts": ["CLC_IP"]
},
{
"groups": ["cluster::default"],
"hosts": ["CC_IP"]
},
{
"groups": ["node::default"],
"hosts": ["NODE_1_IP", "NODE_2_IP""]
}
]
}
EOF
pushd $local/chef-repo/cookbooks/eucalyptus
bootstrap="bootstrap.json"
sed -i "s/CLC_IP/$clc_ip/g" $bootstrap
sed -i "s/NODE_1_IP/$node_1_ip/g" $bootstrap
sed -i "s/CC_IP/$cc_ip/g" $bootstrap
sed -i "s/NODE_2_IP/$node_2_ip/g" $bootstrap
popd
fi
printf "\n Please provide IP addresses of your public subnet reserved on https://eucalyptus.atlassian.net/wiki/display/QSD/Public+IP+Address+Reservation"
echo
read -p "Subnet IP: " subnet_ip
if [ $n -eq 1 ];
then
cat > $local/chef-repo/cookbooks/eucalyptus/environments/my-environment.json <<EOF
{
"name": "poc-managed-novlan",
"description": "DAS - Managed NOVLAN",
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
"eucalyptus": {
"install-type": "source",
"source-branch": "maint/4.0/testing",
"source-repo": "ssh://repo-euca@git.eucalyptus-systems.com/internal",
"rm-source-dir": false,
"install-load-balancer": false,
"install-imaging-worker": false,
"log-level": "DEBUG",
"system-properties": {
"cloud.network.global_min_network_tag": "1",
"cloud.network.global_max_network_tag": "4096"
},
"topology": {
"clc-1": "CLC_IP",
"walrus": "CLC_IP",
"user-facing": ["CLC_IP"],
"clusters": {
"one": {
"cc-1": "CLC_IP",
"sc-1": "CLC_IP",
"storage-backend": "das",
"das-device": "vg01",
"nodes": "NODE_IP"
}
}
},
"nc": {
"max-cores": 32,
"cache-size": 40000
},
"network": {
"mode": "MANAGED-NOVLAN",
"public-ips": "SUBNET.1-SUBNET.255",
"public-interface": "em1",
"private-interface": "em1",
"bridge-interface": "br0",
"bridged-nic": "em1"
},
"init-script-url": "https://gist.githubusercontent.com/viglesiasce/ba3e26beb4d9111145dc/raw/qa-init.sh",
"euca2ools-repo": "http://packages.release.eucalyptus-systems.com/yum/builds/euca2ools/branch/master/centos/6/x86_64/",
"user-console-repo": "http://packages.release.eucalyptus-systems.com/yum/builds/eucalyptus-console/commit/484a359a6d5d7323eecc83d6d1bece08207a6bda-2014-06-18-001/centos/6/x86_64/",
"yum-options": "--nogpg"
}
}
}
EOF
pushd $local/chef-repo/cookbooks/eucalyptus/environments
env="my-environment.json"
subnet=${subnet_ip:2}
sed -i "s/CLC_IP/$clc_ip/g" $env
sed -i "s/NODE_IP/$node_ip/g" $env
sed -i "s/SUBNET/$subnet/g" $env
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment