Skip to content

fix: restart PostgreSQL for new locales after a scrubbed cluster is rebuilt - #41

Merged
solaechea merged 1 commit into
mainfrom
fix/postgresql-flush-after-initialize-40
Nov 4, 2026
Merged

solaechea merged 1 commit into
mainfrom
fix/postgresql-flush-after-initialize-40

Conversation

@solaechea

Copy link
Copy Markdown
Contributor

Written with Claude Opus 5.5

Description

Moves the "Restarting PostgreSQL now so it can use the new locales" flush_handlers from the end of setup-Debian.yml to just after initialize.yml in main.yml.

Before this change, the restart that #29 added ran before initialize.yml. On an image where PostgreSQL is installed but its data directory has been removed, there was no cluster yet at that point, so the restart failed with Unable to start service postgresql@15-main. The cluster only gets rebuilt later, in the "Rebuilding a scrubbed PostgreSQL cluster (Debian)" task. Now the restart runs after the rebuild. On a stock install it is still a restart after the locales are generated and before any database is created, which is what #29 needed.

Closes #40

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New role or feature (non-breaking change which adds functionality)
  • Breaking change (variable renames, removed roles, changed behavior)
  • Documentation update
  • CI/workflow change

Role Convention Checklist

  • ansible-lint passes with zero failures and zero warnings (production profile, strict): not run locally, left to CI
  • Tasks use FQCN modules, gerund names, quoted modes, changed_when on commands
  • meta/argument_specs.yml and the role README updated for any variable or behavior change: no variable changes
  • No secrets in tracked files
  • Checked startcloud.startcloud_roles for overlap
  • Commit messages follow Conventional Commits

Testing performed

The role's molecule/default converge and verify playbooks, run in privileged Debian 12 systemd containers (geerlingguy/docker-debian12-ansible, ansible-core 2.19). en_US.UTF-8 was not generated beforehand in any run.

Starting state main (v0.4.3) This branch
PostgreSQL 15 installed, stopped, data directory removed (the #40 case) converge fails: Unable to start service postgresql@15-main converge ok=37 failed=0, verify ok=24 failed=0, startclouddb collation en_US.UTF-8
Only locales installed (the #29 case) converge and verify pass converge ok=35 failed=0, verify ok=24 failed=0, startclouddb collation en_US.UTF-8

Additional Context

This was found on a SwitchBoard image whose PostgreSQL data directory is removed when the image is built.

…ebuilt #40

Restarting right after the locales were generated came before initialize.yml,
so on an image whose data directory was removed the restart hit a cluster that
did not exist yet and failed. Flush the handlers after initialize.yml instead:
the cluster exists there on both stock and scrubbed images, and the restart
still precedes configure.yml and any database created in the new locale.
@solaechea

solaechea commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

@MarkProminic I am merging this as it seems to be just a fix associated to our own update on #29.
The Molecule error seems to be external and a ticket has been opened for that:
#42

@solaechea
solaechea merged commit 5219a3b into main Nov 4, 2026
53 of 63 checks passed
@solaechea
solaechea deleted the fix/postgresql-flush-after-initialize-40 branch November 4, 2026 14:27
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.

[BUG] postgresql: the locale restart runs before a scrubbed cluster is rebuilt

1 participant