Bug
When postgresql-16 is already installed (from a prior failed run or manual install) but no cluster was initialized, the postgresql Ansible role:
- Skips all installation tasks (
when: _pg_installed.rc != 0 is false)
- Enables and starts
postgresql.service (the Ubuntu meta-wrapper that runs /bin/true)
- Waits 60×5s=300s for the socket at
/var/run/postgresql/.s.PGSQL.5432 that never appears
Root Cause
pg_createcluster 16 main was never run, so /var/lib/postgresql/16/main/ doesn't exist. The meta service starts successfully (/bin/true) but no actual PostgreSQL process ever listens.
Fix
Added two tasks to install.yml between package install and service enable:
- Stat
{{ postgresql_data_dir }}/PG_VERSION
- Initialize cluster via
pg_createcluster {{ postgresql_version }} main when missing
Reproduction
Install PostgreSQL 16, drop or never initialize the cluster, then run deploy-slm-manager.yml.
Impact
install.sh hangs for 5 minutes then fails at step 4 of 7.
Bug
When
postgresql-16is already installed (from a prior failed run or manual install) but no cluster was initialized, thepostgresqlAnsible role:when: _pg_installed.rc != 0is false)postgresql.service(the Ubuntu meta-wrapper that runs/bin/true)/var/run/postgresql/.s.PGSQL.5432that never appearsRoot Cause
pg_createcluster 16 mainwas never run, so/var/lib/postgresql/16/main/doesn't exist. The meta service starts successfully (/bin/true) but no actual PostgreSQL process ever listens.Fix
Added two tasks to
install.ymlbetween package install and service enable:{{ postgresql_data_dir }}/PG_VERSIONpg_createcluster {{ postgresql_version }} mainwhen missingReproduction
Install PostgreSQL 16, drop or never initialize the cluster, then run
deploy-slm-manager.yml.Impact
install.sh hangs for 5 minutes then fails at step 4 of 7.