From bbc7ca7840abbba96ec37bc500df465e8a7d67d0 Mon Sep 17 00:00:00 2001 From: Damian Wrobel Date: Fri, 21 Feb 2025 13:09:28 +0100 Subject: [PATCH] Assume default 'log' for postgres_log_dir Fixes the following error: TASK [geerlingguy.postgresql : Define postgresql_log_dir.] fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'log_directory'. 'dict object' has no attribute when reporting and logging will be redirected to journald by using the following configuration: postgresql_global_config_options: - option: log_destination value: 'stderr' - option: logging_collector value: 'off' - option: log_line_prefix value: '' Note: the log_directory is not used when 'logging_collector' is 'off'. Signed-off-by: Damian Wrobel --- tasks/variables.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/variables.yml b/tasks/variables.yml index 7e3a7a5..28686cc 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -59,7 +59,7 @@ set_fact: # postgresql_global_config_options is an array but its keys are unique, so it can be converted to dict, # to easily get the value under the 'log_directory' key - postgresql_log_dir: "{{ (postgresql_global_config_options | items2dict(key_name='option', value_name='value')).log_directory }}" + postgresql_log_dir: "{{ (postgresql_global_config_options | items2dict(key_name='option', value_name='value')).log_directory | default('log') }}" - name: Define postgresql_effective_log_dir, if postgresql_log_dir is absolute set_fact: