this repo has no description
1---
2# yaml-language-server: $schema=https://taskfile.dev/schema.json
3version: "3"
4
5vars:
6 # Directories
7 ANSIBLE_DIR: "{{.ROOT_DIR}}/provision/ansible"
8 BOOTSTRAP_DIR: "{{.ROOT_DIR}}/bootstrap"
9 KUBERNETES_DIR: "{{.ROOT_DIR}}/k8s"
10 PRIVATE_DIR: "{{.ROOT_DIR}}/.private"
11 SCRIPTS_DIR: "{{.ROOT_DIR}}/scripts"
12 # Files
13 AGE_FILE: "{{.ROOT_DIR}}/age.key"
14 BOOTSTRAP_CONFIG_FILE: "{{.ROOT_DIR}}/config.yaml"
15 KUBECONFIG_FILE: "{{.ROOT_DIR}}/kubeconfig"
16 MAKEJINJA_CONFIG_FILE: "{{.ROOT_DIR}}/makejinja.toml"
17 PIP_REQUIREMENTS_FILE: "{{.ROOT_DIR}}/requirements.txt"
18 SOPS_CONFIG_FILE: "{{.ROOT_DIR}}/.sops.yaml"
19 # Binaries
20 PYTHON_BIN: python3
21
22env:
23 KUBECONFIG: "{{.KUBECONFIG_FILE}}"
24 PYTHONDONTWRITEBYTECODE: "1"
25 SOPS_AGE_KEY_FILE: "{{.AGE_FILE}}"
26 VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
27
28includes:
29 ansible: .taskfiles/Ansible
30 kubernetes: .taskfiles/Kubernetes
31 flux: .taskfiles/Flux
32 repository: .taskfiles/Repository
33 talos: .taskfiles/Talos
34 sops: .taskfiles/Sops
35 workstation: .taskfiles/Workstation
36 externalsecrets: .taskfiles/ExternalSecrets
37 volsync: .taskfiles/VolSync
38 user:
39 taskfile: .taskfiles/User
40 optional: true
41
42tasks:
43
44 default: task --list
45
46 init:
47 desc: Initialize configuration files
48 cmds:
49 - cp -n {{.BOOTSTRAP_CONFIG_FILE | replace ".yaml" ".sample.yaml"}} {{.BOOTSTRAP_CONFIG_FILE}}
50 - cmd: echo === Configuration file copied ===
51 - cmd: echo Proceed with updating the configuration files...
52 - cmd: echo {{.BOOTSTRAP_CONFIG_FILE}}
53 status:
54 - test -f {{.BOOTSTRAP_CONFIG_FILE}}
55 silent: true
56
57 configure:
58 desc: Configure repository from bootstrap vars
59 prompt: Any conflicting config in the kubernetes directory will be overwritten... continue?
60 deps: ["workstation:direnv", "workstation:venv", "sops:age-keygen", "init"]
61 cmds:
62 - task: .template
63 - task: sops:encrypt
64 - task: .validate
65
66 .template:
67 internal: true
68 cmd: "{{.VIRTUAL_ENV}}/bin/makejinja"
69 preconditions:
70 - msg: Missing virtual environment
71 sh: test -d {{.VIRTUAL_ENV}}
72 - msg: Missing Makejinja config file
73 sh: test -f {{.MAKEJINJA_CONFIG_FILE}}
74 - msg: Missing Makejinja plugin file
75 sh: test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py
76 - msg: Missing bootstrap config file
77 sh: test -f {{.BOOTSTRAP_CONFIG_FILE}}
78
79 .validate:
80 internal: true
81 cmds:
82 - task: kubernetes:kubeconform
83 - cmd: echo === Done rendering and validating YAML ===
84 - cmd: |
85 if [[ $KUBECONFIG != "{{.KUBECONFIG_FILE}}" ]]; then
86 echo WARNING: KUBECONFIG is not set to the expected value, this may cause conflicts.
87 fi
88 - cmd: |
89 if [[ $SOPS_AGE_KEY_FILE != "{{.AGE_FILE}}" ]]; then
90 echo WARNING: SOPS_AGE_KEY_FILE is not set to the expected value, this may cause conflicts.
91 fi
92 - cmd: |
93 if test -f ~/.config/sops/age/keys.txt; then
94 echo WARNING: SOPS Age key found in home directory, this may cause conflicts.
95 fi
96 silent: true