2016-06-16 09:48:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-06-20 09:05:17 +00:00
|
|
|
INVENTORY="kargo/inventory/inventory.cfg"
|
|
|
|
|
2016-06-16 09:48:51 +00:00
|
|
|
nodes=""
|
2016-06-16 12:42:53 +00:00
|
|
|
i=1
|
2016-06-16 09:48:51 +00:00
|
|
|
for nodeip in `cat /root/nodes` ; do
|
|
|
|
i=$(( $i+1 ))
|
|
|
|
nodes+=" node${i}[ansible_ssh_host=${nodeip},ip=${nodeip}]"
|
|
|
|
done
|
|
|
|
|
2016-06-20 09:05:17 +00:00
|
|
|
if [ -f "$INVENTORY" ] ; then
|
|
|
|
echo "$INVENTORY already exists, if you want to recreate, pls remove it and re-run this script"
|
2016-06-16 10:19:27 +00:00
|
|
|
else
|
|
|
|
echo "Preparing inventory..."
|
|
|
|
kargo prepare -y --nodes $nodes
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running deployment..."
|
2016-06-20 09:05:17 +00:00
|
|
|
kargo deploy -y --ansible-opts="-e @custom.yaml"
|
2016-06-16 09:48:51 +00:00
|
|
|
deploy_res=$?
|
|
|
|
|
|
|
|
if [ "$deploy_res" -eq "0" ]; then
|
|
|
|
echo "Setting up kubedns..."
|
2016-06-20 09:05:17 +00:00
|
|
|
ansible-playbook -i $INVENTORY kubedns.yaml
|
2016-06-16 09:48:51 +00:00
|
|
|
fi
|