Files
home-cluster/Taskfile.yaml
T
Devin Buhl 79b3de005e chore: housekeeping
Signed-off-by: Devin Buhl <devin@buhl.casa>
2024-04-05 15:08:47 -04:00

82 lines
2.5 KiB
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
# Directories
ANSIBLE_DIR: "{{.ROOT_DIR}}/ansible"
BOOTSTRAP_DIR: "{{.ROOT_DIR}}/bootstrap"
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
PRIVATE_DIR: "{{.ROOT_DIR}}/.private"
SCRIPTS_DIR: "{{.ROOT_DIR}}/scripts"
# Files
AGE_FILE: "{{.ROOT_DIR}}/age.key"
BOOTSTRAP_CONFIG_FILE: "{{.ROOT_DIR}}/config.yaml"
KUBECONFIG_FILE: "{{.ROOT_DIR}}/kubeconfig"
MAKEJINJA_CONFIG_FILE: "{{.ROOT_DIR}}/makejinja.toml"
PIP_REQUIREMENTS_FILE: "{{.ROOT_DIR}}/requirements.txt"
# Binaries
PYTHON_BIN: python3
env:
KUBECONFIG: "{{.KUBECONFIG_FILE}}"
PYTHONDONTWRITEBYTECODE: "1"
SOPS_AGE_KEY_FILE: "{{.AGE_FILE}}"
VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
includes:
ansible: .taskfiles/Ansible/Taskfile.yaml
kubernetes:
aliases: ["k8s"]
taskfile: .taskfiles/Kubernetes/Taskfile.yaml
flux: .taskfiles/Flux/Taskfile.yaml
repository:
aliases: ["repo"]
taskfile: .taskfiles/Repository/Taskfile.yaml
talos: .taskfiles/Talos/Taskfile.yaml
sops: .taskfiles/Sops/Taskfile.yaml
workstation: .taskfiles/Workstation/Taskfile.yaml
user:
taskfile: .taskfiles/User
optional: true
tasks:
default: task -l
init:
desc: Initialize configuration files
cmds:
- cp -n {{.BOOTSTRAP_CONFIG_FILE | replace ".yaml" ".sample.yaml"}} {{.BOOTSTRAP_CONFIG_FILE}}
- cmd: echo === Configuration file copied ===
silent: true
- cmd: echo Proceed with updating the configuration files...
silent: true
- cmd: echo {{.BOOTSTRAP_CONFIG_FILE}}
silent: true
status:
- test -f "{{.BOOTSTRAP_CONFIG_FILE}}"
configure:
desc: Configure repository from bootstrap vars
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
deps: ["workstation:direnv", "workstation:venv", "sops:age-keygen", "init"]
cmds:
- task: .template
- task: sops:encrypt
- task: .validate
.template:
internal: true
cmd: "{{.VIRTUAL_ENV}}/bin/makejinja"
preconditions:
- { msg: "Missing virtual environment", sh: "test -d {{.VIRTUAL_ENV}}" }
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
- { msg: "Missing Makejinja plugin file", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py" }
- { msg: "Missing bootstrap config file", sh: "test -f {{.BOOTSTRAP_CONFIG_FILE}}" }
.validate:
internal: true
cmds:
- task: kubernetes:kubeconform