summaryrefslogtreecommitdiff
path: root/run-cluster.sh
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-03-17 14:18:37 +0200
committerLars Wirzenius <liw@liw.fi>2018-03-17 14:18:37 +0200
commitaed23d8f331f8330a06bf60dbc65d91d408fe329 (patch)
treee54e9f8a802f8a3454bea4152f8ba685e6078a5d /run-cluster.sh
parentac0054e56d81112cfc821d43ea0713f9c25e5d20 (diff)
downloadick2-ansible-aed23d8f331f8330a06bf60dbc65d91d408fe329.tar.gz
Change: read addresses from a hosts.in file
Diffstat (limited to 'run-cluster.sh')
-rwxr-xr-xrun-cluster.sh38
1 files changed, 31 insertions, 7 deletions
diff --git a/run-cluster.sh b/run-cluster.sh
index 273eae7..b67df53 100755
--- a/run-cluster.sh
+++ b/run-cluster.sh
@@ -1,10 +1,34 @@
-#!/bin/sh
+#!/bin/bash
set -eu
-./run-playbook \
- ick-cluster.yml \
- -e ansible_ssh_user=root \
- -e controller_domain=207.154.212.62 \
- -e blob_service_domain=207.154.244.235 \
- "$@"
+
+hosts_in=hosts.in
+
+
+getip()
+{
+ awk -v "name=$1" '$1 == name { print $2 }' "$hosts_in"
+}
+
+
+mkhosts()
+{
+ cat <<EOF
+[ick]
+controller hostname=controller ansible_ssh_host=$(getip controller)
+blob_service hostname=blob_service ansible_ssh_host=$(getip blobs)
+worker1 hostname=worker1 ansible_ssh_host=$(getip worker1)
+worker2 hostname=worker2 ansible_ssh_host=$(getip worker2)
+
+[workers]
+worker1
+worker2
+EOF
+}
+
+mkhosts > hosts.tmp
+ansible-playbook -i hosts.tmp ick-cluster.yml \
+ -e "controller_domain=$(getip controller)" \
+ -e "blob_service_domain=$(getip blobs)" \
+ "$@"