Files
home-cluster/.taskfiles/Sops/Taskfile.yaml
T
Devin Buhl 3b0fcb7ba5 feat: update network and cert-manager ns (#1263)
* feat: update network and cert-manager ns

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update sops var name to be consistent with env

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
2024-01-26 18:48:35 -05:00

39 lines
990 B
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
SOPS_CONFIG_FILE: "{{.ROOT_DIR}}/.sops.yaml"
tasks:
age-keygen:
desc: Initialize Age Key for Sops
cmd: age-keygen --output {{.SOPS_AGE_KEY_FILE}}
status:
- test -f "{{.SOPS_AGE_KEY_FILE}}"
encrypt:
desc: Encrypt all Kubernetes SOPS secrets that are not already encrypted
cmds:
- for: { var: file }
task: .encrypt-file
vars:
file: "{{.ITEM}}"
vars:
file:
sh: find "{{.KUBERNETES_DIR}}" -type f -name "*.sops.*" -exec grep -L "ENC\[AES256_GCM" {} \;
.encrypt-file:
internal: true
cmd: sops --encrypt --in-place {{.file}}
requires:
vars: ["file"]
preconditions:
- { msg: "Missing Sops config file", sh: "test -f {{.SOPS_CONFIG_FILE}}" }
- { msg: "Missing Sops Age key file", sh: "test -f {{.SOPS_AGE_KEY_FILE}}" }
.reset:
internal: true
cmd: rm -rf {{.SOPS_CONFIG_FILE}}