forked from kernelci/kernelci-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ansible
executable file
·48 lines (39 loc) · 830 Bytes
/
ansible
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
#!/bin/sh
set -e
repo="${1}"
target="${2}"
git_rev="${3:-staging.kernelci.org}"
ansible_rev="${4:-main}"
key="${5:-$PWD/keys/id_rsa_staging.kernelci.org}"
opts="${6}"
[ "$repo" = "kernelci-backend" ] || \
[ "$repo" = "kernelci-frontend" ] || \
[ "$repo" = "kernelci-reports" ] || {
echo "Invalid repo name: $repo"
exit 1
}
[ -z "$target" ] && {
echo "Missing target"
exit 1
}
path="checkout/$repo-config"
[ -d "$path" ] || {
git clone https://github.com/kernelci/"$repo"-config.git "$path"
}
[ -e "$key" ] && key_arg="--private-key $key" || key_arg=""
cd "$path"
git checkout "$ansible_rev"
git pull --ff-only
ansible-playbook \
site.yml \
-i hosts \
-l "$target" \
-D \
-b \
--skip-tags=secrets \
-t app \
$key_arg \
$opts \
-e git_head="$git_rev"
cd -
exit 0