summaryrefslogtreecommitdiff
path: root/ansible/all.sh
blob: 2aaf5364bc0c096f8ebed2f8c42f574ab9b06637 (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
53
#!/bin/bash

set -eu

newer()
{
    [ "$1" -nt "$2" ] || [ ! -e "$2" ]
}


online()
{
    ping -c1 "$1" > /dev/null 2>/dev/null
}

maybe_run_playbook()
{
    if newer "$1.yml" "$1.stamp" && online "$1"
    then
	echo "$1"
	chronic ./run-playbook "$1.yml"
	touch "$1.stamp"
    else
	echo "SKIPPING $1"
    fi
}

maybe_run_ansible()
{
    if newer "$1.yml" "$1.stamp" && online "$1"
    then
	echo "$1"
	chronic run-ansible "$1.hz" "hosts.$2" "$1.yml"
	touch "$1.stamp"
    else
	echo "SKIPPING $1"
    fi
}

maybe_run_playbook exolobe1
maybe_run_playbook exolobe2
maybe_run_playbook exolobe5
maybe_run_playbook exolobe6
maybe_run_playbook holywood2
maybe_run_playbook web
maybe_run_playbook atuin.liw.fi

maybe_run_ansible git.liw.fi git
maybe_run_ansible http.liw.fi http
maybe_run_ansible irc.liw.fi irc
maybe_run_ansible shell-shell.vm.liw.fi shell
maybe_run_ansible mirror-git.vm.liw.fi mirror
maybe_run_ansible letest-letest.vm.liw.fi letest