summaryrefslogtreecommitdiff
path: root/run-cluster.sh
blob: 8311fb7efcc385a7f9b6834b0baaab3241237c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

set -eu


hosts_in="$1"
shift 1


getip()
{
    awk -v "name=$1" '$1 == name { print $2 }' "$hosts_in"
}


mkhosts()
{
    cat <<EOF
[ick]
qvisqve hostname=controller ansible_ssh_host=$(getip qvisqve)
controller hostname=controller ansible_ssh_host=$(getip controller)
artifacts hostname=blob_service ansible_ssh_host=$(getip artifacts)
apt hostname=apt ansible_ssh_host=$(getip apt)
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 "qvisqve_domain=$(getip qvisqve)" \
                 -e "controller_domain=$(getip controller)" \
                 -e "artifact_store_domain=$(getip artifacts)" \
                 -e "apt_domain=$(getip apt)" \
                 "$@"