-
-
Notifications
You must be signed in to change notification settings - Fork 288
/
Copy pathTaskfile.yaml
79 lines (69 loc) · 2.74 KB
/
Taskfile.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
BOOTSTRAP_DIR: "{{.ROOT_DIR}}/bootstrap"
ANSIBLE_DIR: "{{.ROOT_DIR}}/ansible"
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
env:
KUBECONFIG: "{{.ROOT_DIR}}/kubeconfig"
includes:
ansible: .taskfiles/Ansible/Taskfile.yaml
kubernetes:
aliases: ["k8s"]
taskfile: .taskfiles/Kubernetes/Taskfile.yaml
flux: .taskfiles/Flux/Taskfile.yaml
k0s: .taskfiles/K0s/Taskfile.yaml
repo: .taskfiles/Repo/Taskfile.yaml
sops: .taskfiles/Sops/Taskfile.yaml
workstation: .taskfiles/Workstation/Taskfile.yaml
tasks:
default: task -l
init:
desc: Initialize configuration files
cmds:
- cp -n {{.BOOTSTRAP_DIR}}/vars/addons.sample.yaml {{.BOOTSTRAP_DIR}}/vars/addons.yaml
- cp -n {{.BOOTSTRAP_DIR}}/vars/config.sample.yaml {{.BOOTSTRAP_DIR}}/vars/config.yaml
- cmd: echo "=== Configuration files copied ==="
silent: true
- cmd: echo "Proceed with updating the configuration files..."
silent: true
- cmd: echo "{{.BOOTSTRAP_DIR}}/vars/config.yaml"
silent: true
- cmd: echo "{{.BOOTSTRAP_DIR}}/vars/addons.yaml"
silent: true
status:
- test -f "{{.BOOTSTRAP_DIR}}/vars/addons.yaml"
- test -f "{{.BOOTSTRAP_DIR}}/vars/config.yaml"
# TODO: Only prompt when generated directories exist
# https://github.com/go-task/task/issues/1330
configure:
desc: Configure repository from Ansible vars
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
cmds:
- task: .pre-validate
- task: .template
- task: .post-validate
.pre-validate:
internal: true
cmd: ./.venv/bin/ansible-playbook {{.BOOTSTRAP_DIR}}/validate.yaml
env:
ANSIBLE_DISPLAY_SKIPPED_HOSTS: "false"
preconditions:
- { msg: "addons file not found", sh: "test -f {{.BOOTSTRAP_DIR}}/vars/addons.yaml" }
- { msg: "config file not found", sh: "test -f {{.BOOTSTRAP_DIR}}/vars/config.yaml" }
.template:
internal: true
cmds:
- ./.venv/bin/makejinja --force
- task: sops:encrypt:all
preconditions:
- { msg: "bootstrap addons file not found", sh: "test -f {{.BOOTSTRAP_DIR}}/vars/addons.yaml" }
- { msg: "bootstrap config file not found", sh: "test -f {{.BOOTSTRAP_DIR}}/vars/config.yaml" }
- { msg: "makejinja loader file not found", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/loader.py" }
- { msg: "makejinja config file not found", sh: "test -f {{.ROOT_DIR}}/makejinja.toml" }
.post-validate:
internal: true
cmd: ./.github/scripts/kubeconform.sh {{.KUBERNETES_DIR}}
preconditions:
- { msg: "kubeconform file not found", sh: "test -f ./.github/scripts/kubeconform.sh" }