Files
homelab/tasks/postgres.yaml
2023-09-19 20:58:26 -03:00

46 lines
1.6 KiB
YAML

version: '3'
vars:
PATH_ERROR: is not installed or correctly configured in PATH.
silent: true
tasks:
secret:roles:
cmds:
- rm config/infra-roles-secret.yaml
- |
cat << EOF > config/infra-roles-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: postgresql-infrastructure-roles-new
namespace: databases
data:
user: $B64_POSTGRES_ADMIN_USER
password: $B64_POSTGRES_ADMIN_PASSWORD
type: Opaque
EOF
- kubectl apply -f config/infra-roles-secret.yaml
- rm config/infra-roles-secret.yaml
ignore_error: true
label:
cmds:
- kubectl label node node-one postgres-operator=enabled
decrypt:
cmds:
- echo -e "usage 'task postgres:decrypt -- {namespace}.{username}.{team}-{clustername}'\n"
- echo -e "$(kubectl get secret -n $(echo '{{.CLI_ARGS}}' | cut -d '.' -f 1) {{.CLI_ARGS}}.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)"
ignore_error: true
known:
cmds:
- echo -e "Home assistant:"
- echo "$(kubectl get secret -n homeassistant homeuser.apps-ha-db.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)"
- echo -e "Drone:"
- echo "$(kubectl get secret -n drone ciuser.apps-drone-db.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)"
- echo -e "n8n:"
- echo "$(kubectl get secret -n services automateuser.apps-n8n-db.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)"
ignore_error: true