make postgres password optional

This commit is contained in:
Robert Kaussow 2024-08-13 10:18:04 +02:00
parent 9e7aa62e09
commit e74e49c50f
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 6 additions and 3 deletions

View File

@ -52,8 +52,8 @@ postgres_podman_args:
postgres_log_level: warning postgres_log_level: warning
postgres_user: postgres postgres_user: postgres
postgres_password: postgres # @var postgres_password:description: Password of the superuser defined in `postgres_user`.
postgres_db: postgres # postgres_password:value: $ "_unset_"
# @var postgres_app_user:description: > # @var postgres_app_user:description: >
# Application user name without superuser privileges. Full access to `postgres_db` # Application user name without superuser privileges. Full access to `postgres_db`
@ -63,10 +63,11 @@ postgres_db: postgres
# @var postgres_app_password:description: Application user password. # @var postgres_app_password:description: Application user password.
# @var postgres_app_password:value: $ "_unset_" # @var postgres_app_password:value: $ "_unset_"
postgres_db: postgres
postgres_host_auth_method: scram-sha-256 postgres_host_auth_method: scram-sha-256
postgres_initdb_args: postgres_initdb_args:
- --auth-host=scram-sha-256 - --auth-host=scram-sha-256
- --auth-local=scram-sha-256
postgres_tls_enabled: False postgres_tls_enabled: False
postgres_tls_ca_file: "/var/lib/postgresql/tls/CA.pem" postgres_tls_ca_file: "/var/lib/postgresql/tls/CA.pem"

View File

@ -1,7 +1,9 @@
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
{{ ansible_managed | comment }} {{ ansible_managed | comment }}
POSTGRES_USER={{ postgres_user }} POSTGRES_USER={{ postgres_user }}
{% if postgres_password is defined %}
POSTGRES_PASSWORD={{ postgres_password }} POSTGRES_PASSWORD={{ postgres_password }}
{% endif %}
{% if postgres_app_user is defined and postgres_app_password is defined %} {% if postgres_app_user is defined and postgres_app_password is defined %}
POSTGRES_APP_USER={{ postgres_app_user }} POSTGRES_APP_USER={{ postgres_app_user }}
POSTGRES_APP_PASSWORD={{ postgres_app_password }} POSTGRES_APP_PASSWORD={{ postgres_app_password }}