Files
home-cluster/.taskfiles/Sops/Taskfile.yaml
T

31 lines
847 B
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
tasks:
age-keygen:
desc: Initialize Age Key for Sops
cmd: age-keygen --output {{.AGE_FILE}}
status: ["test -f {{.AGE_FILE}}"]
encrypt:
desc: Encrypt all Kubernetes SOPS secrets
cmds:
- cmd: |
find "{{.KUBERNETES_DIR}}" -type f -name "*.sops.*" | while read -r file; do
if sops filestatus "$file" | jq --exit-status ".encrypted == false" > /dev/null; then
sops --encrypt --in-place "$file"
echo "Encrypted $file"
fi
done
preconditions:
- msg: Missing Sops config file
sh: test -f {{.SOPS_CONFIG_FILE}}
- msg: Missing Sops Age key file
sh: test -f {{.AGE_FILE}}
.reset:
internal: true
cmd: rm -rf {{.SOPS_CONFIG_FILE}}