/
run.sh
executable file
·56 lines (44 loc) · 1.02 KB
/
run.sh
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
54
55
56
#!/usr/bin/env bash
set -euo pipefail
decrypt() {
if [ -n "${1-}" ]; then
echo "decrypting ${1}.yaml"
sops -d -i "${@}".yaml
else
sops -d -i secrets/secrets.yaml
fi
}
encrypt() {
if [ -n "${1-}" ]; then
echo "encrypting ${1}.yaml"
sops -e -i "${@}".yaml
else
sops -e -i secrets/secrets.yaml
fi
}
bootstrap() {
kubectl create namespace flux-system
echo "Installing Flux"
flux bootstrap github \
--owner=teaglebuilt \
--repository=homelab \
--branch=master \
--path=clusters/dev \
--network-policy=false \
--watch-all-namespaces=true \
--namespace=flux-system \
--personal
}
playbook() {
echo "running playbook ${1}"
ansible-playbook -i ansible/inventory.ini \
--extra-vars \
"ansible_user=${ANSIBLE_USER} \
ansible_password=${ANSIBLE_PASS}" \
ansible/${1}.yaml
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
}
"${@:-help}"