summaryrefslogtreecommitdiff
path: root/run-cluster.sh
diff options
context:
space:
mode:
Diffstat (limited to 'run-cluster.sh')
-rwxr-xr-xrun-cluster.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/run-cluster.sh b/run-cluster.sh
new file mode 100755
index 0000000..4c987ab
--- /dev/null
+++ b/run-cluster.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -eu
+
+
+getaddr()
+{
+ awk -v "name=$1" '$1 == name { print $2 }' "$hosts_in" |
+ sed 's/ansible_ssh_host=//'
+}
+
+
+mkhosts()
+{
+ cat <<EOF
+ick ansible_ssh_host=$(getaddr controller)
+worker1 hostname=worker1 ansible_ssh_host=$(getaddr worker1)
+worker2 hostname=worker2 ansible_ssh_host=$(getaddr worker2)
+
+[ickhost]
+ick
+worker1
+worker2
+
+[controller]
+ick
+
+[qvisqve]
+ick
+
+[apt]
+ick
+
+[notify]
+ick
+
+[workers]
+worker1
+worker2
+EOF
+}
+
+hosts_in="$1"
+shift 1
+mkhosts > hosts.tmp
+ansible-playbook -i hosts.tmp ick-cluster.yml \
+ -e "qvisqve_domain=$(getaddr controller)" \
+ -e "controller_domain=$(getaddr controller)" \
+ -e "artifact_store_domain=$(getaddr controller)" \
+ -e "apt_domain=$(getaddr controller)" \
+ -e "notify_domain=$(getaddr controller)" \
+ "$@"