Skip to content

Commit

Permalink
Make the create manager on cirycloud better (smaller flavor) more aut…
Browse files Browse the repository at this point in the history
…omation (openstack config)

A script to delete unsued floatingip to save $
  • Loading branch information
thomnico committed Jan 26, 2018
1 parent e5719e1 commit ca4ca04
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions cloudify/bleach-floatingips.sh
@@ -0,0 +1,4 @@
#!/bin/bash -ex

# release all floating ip not in use (save $$)
openstack floating ip list -f value -c "Floating IP Address" --status DOWN |xargs openstack floating ip delete
1 change: 0 additions & 1 deletion cloudify/collector/README.md

This file was deleted.

19 changes: 18 additions & 1 deletion cloudify/manager-on-openstackvm
Expand Up @@ -44,7 +44,16 @@ fi

#if EXT_NET variable not set use default (allow to have it as param from the .rc file)
[ -x $EXT_NET ] && EXT_NET=ext-net
[ -x $OS_FLAVOR ] && OS_FLAVOR=2C-2GB-50GB
#Follow http://docs.getcloudify.org/
export LC_ALL=C

sudo apt -y install python-pip python-virtualenv wget git
#sudo pip install --upgrade pip
# if already install do nothing
[ -f cloudify-cli-4.2ga.deb ] || wget -c http://repository.cloudifysource.org/cloudify/4.2.0/ga-release/cloudify-cli-4.2ga.deb

(dpkg -l cloudify >/dev/null) || sudo dpkg -i cloudify*.deb

#Push image if needed
openstack image show "cfy-manager4.2" > /dev/null 2>&1 || openstack image create --disk-format qcow2 --container-format bare "cfy-manager4.2" --file cloudify-manager-4.2ga.qcow2
Expand All @@ -53,15 +62,23 @@ if (openstack server show cfy-manager > /dev/null 2>&1 );then
echo "cloudify manager already started"
FLOAT_IP=`openstack server show cfy-manager -f value -c addresses|awk -F , '{print $2}'`
else
openstack server create --image "cfy-manager4.2" cfy-manager --key-name default --security-group default --flavor 2C-4GB-50GB --network mgmt
openstack server create --image "cfy-manager4.2" cfy-manager --key-name default --security-group default --flavor $OS_FLAVOR --network mgmt
while [ `openstack server show cfy-manager -f value -c status` == "BUILD" ]; do
sleep 4
done
FLOAT_IP=`openstack floating ip create $EXT_NET -f value -c floating_ip_address`
openstack server add floating ip cfy-manager $FLOAT_IP
fi
until (ssh -o StrictHostKeyChecking=no centos@$FLOAT_IP ping -c 3 cloudify.co); do
sleep 4
echo "waiting the vm to be up"
done
## change the default openstack config to use the one currently on.
envsubst < openstack_config.template | ssh -o StrictHostKeyChecking=no centos@$FLOAT_IP sudo tee /etc/cloudify/openstack_config.json

cfy init -r
#Colors in the logs
sed -i 's/colors: false/colors: true/g' $HOME/.cloudify/config.yaml
cfy profiles use $FLOAT_IP -u admin -p admin -t default_tenant
cfy status

0 comments on commit ca4ca04

Please sign in to comment.