summaryrefslogtreecommitdiff
path: root/run-cluster.sh
blob: 4c987abcf71a47481083ec4df4f994809082d454 (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
40
41
42
43
44
45
46
47
48
49
50
51
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)" \
                 "$@"