ansible/roles/keycloak/tasks/secrets.yaml
2024-05-06 03:00:10 +03:00

26 lines
919 B
YAML

- block:
- name: Set DB namespace for secret lookup
set_fact:
db_namespace: "{{ keycloak_db_namespace | default(postgres_db_namespace) | default(postgres_namespace) | default(postgres_operator_namespace) | default(namespace) }}"
- name: Set DB secret name for lookup
set_fact:
db_secret_name: "keycloak.{{ postgres_db_team | default(namespace) }}-postgres.credentials.postgresql.acid.zalan.do"
- name: Lookup Keycloak DB secret
set_fact:
keycloak_db_secret: "{{ lookup('k8s', kind='Secret', namespace=db_namespace, resource_name=db_secret_name) }}"
- debug:
msg: "{{ keycloak_db_secret }}"
verbosity: 2
- name: Set Keycloak DB username
set_fact:
keycloak_db_username: "{{ keycloak_db_secret.data.username | b64decode }}"
- name: Set Keycloak DB password
set_fact:
keycloak_db_password: "{{ keycloak_db_secret.data.password | b64decode }}"