Skip to content

Conversation

rantanevich
Copy link

Hello!

I'm trying to install PostgreSQL on a fresh Ubuntu 22.04 with postgresql_data_directory: /data/postgresql, but I'm getting the following error:

TASK [anxs.postgresql : PostgreSQL | Verify postgresql cluster version] ********
fatal: [postgresql-17]: FAILED! => {"changed": false, "cmd": ["grep", "^17$", "/data/postgresql/PG_VERSION"], "delta": "0:00:00.001677", "end": "2025-06-03 15:31:21.968610", "msg": "non-zero return code", "rc": 2, "start": "2025-06-03 15:31:21.966933", "stderr": "grep: /data/postgresql/PG_VERSION: No such file or directory", "stderr_lines": ["grep: /data/postgresql/PG_VERSION: No such file or directory"], "stdout": "", "stdout_lines": []}

The only workaround I've found is to set postgresql_cluster_reset: true, but that's not very convenient.

Instead, I suggest reinitializing the cluster not only when postgresql_cluster_reset: true, but also when postgresql_data_directory is empty (contains no files or directories).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant