summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-04-29 18:42:57 +0300
committerLars Wirzenius <liw@liw.fi>2019-04-29 18:42:57 +0300
commit2f9bcb0a8b0f042f16615aeb761a309a176755ff (patch)
tree2cd1476214213021d51daf352374e98e7a272a9a
parentbb4a54ec409e0b0e9c33f4c30f47b2391f051691 (diff)
downloadick2-ansible-2f9bcb0a8b0f042f16615aeb761a309a176755ff.tar.gz
Add: run-cluster.sh for ci-prep
ci-prep's job to update Ick on ci-prod requires ci-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)" \
+ "$@"