c12s-kubespray/deploy-k8s.kargo.sh

30 lines
782 B
Bash
Raw Normal View History

#!/bin/bash
2016-06-30 13:35:00 +00:00
INVENTORY="/root/kargo/inventory/inventory.cfg"
nodes=""
i=1
2016-06-30 13:32:46 +00:00
for nodeip in `cat nodes` ; do
i=$(( $i+1 ))
nodes+=" node${i}[ansible_ssh_host=${nodeip},ip=${nodeip}]"
done
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..."
#kargo deploy -y --ansible-opts="-e @custom.yaml"
2016-06-30 13:35:00 +00:00
ansible-playbook -i $INVENTORY /root/kargo/cluster.yml -e @custom.yaml
deploy_res=$?
if [ "$deploy_res" -eq "0" ]; then
echo "Setting up kubedns..."
ansible-playbook -i $INVENTORY playbooks/kubedns.yaml
2016-06-27 15:57:29 +00:00
echo "Setting up kubedashboard..."
ansible-playbook -i $INVENTORY playbooks/kubedashboard.yaml
fi