Commit Graph

6 Commits (dbcb932ceda354280d0ab0e6e9ce13e405d90940)

Author SHA1 Message Date
Dustin 965742d2b0 r/postgresql-server-base: Factor out prep steps
There's a bit of a dependency loop between the _postgresql-server_ role
and other roles that supplement it, like _wal-g-pg_ and
_postgresql-cert_.  The latter roles need PostgreSQL installed, but when
those roles are used, the server cannot be started until they have been
applied.  To resolve this situation, I've broken out the initial
installation steps from the _postgresql-server_ role into
_postgresql-server-base_.  Roles that need PostgreSQL installed, but
need to be applied before the server can start, can depend on this role.
2024-11-17 10:27:31 -06:00
Dustin 53b39338dd r/postgresql-server: Add script to upgrade database
The `postgresql-upgrade.sh` script arranges to run `pg_upgrade` after a
major PostgreSQL version update.  It's scheduled by a systemd unit,
_postgresql-upgrade.service_, which runs only after an OS update.
2024-11-17 10:27:31 -06:00
Dustin 9e742dc217 roles/postgresql-server: Rewrite role
This rewrite brings a lot of improvements and new functionality to the
*postgresql-server* role.  The most noticeable change is the
introduction of the `postgresql_config_dir` variable, which can be used
to specify a different location for the PostgreSQL server configuration
files, separate from the data storage directory.  By default, the
variable is set to `/etc/postgresql`.  For some situations, it may be
necessary to disable this functionality, which can be accomplished by
setting the value of `postgresql_config_dir` to the same path as
`pgdata_dir`.  Note also that the `postgresql-setup` tool, and the
corresponding `postgresql-check-db-dir` script, which are included in
the Fedora/Red Hat distribution of PostgreSQL, do not support having
separate configuration and data directories, so their use has to be
disabled.

Another significant improvement is to how the `postgresql.conf` file
is generated.  Any setting can be set now, using the `postgresql_config`
variable; any key in this dictionary will be written to the
configuration file.  Note that configuration file syntax requires
single quotes around string values, so these have to be included in the
YAML value.

To support deploying standby servers, the role now supports running a
command to restore from a backup instead of running `initdb`.
Additionally, the `postgresql_standby` variable can be set to `true`
to create the `recovery.signal` file, configuring the server as a
standby.
2024-07-02 20:44:29 -05:00
Dustin a614f7b5c7 roles/postgresql-server: Remove postgresql-setup
The *postgresql-setup* service is no longer necessary, as upstream has
fixed the SELinux policy to allow root to invoke the `postgresql-setup`
command directly.
2020-07-14 10:56:01 -05:00
Dustin f4e5aacf52 roles/postgresql-server: Support SSL configuration
This commit adds a task to generate a PostgreSQL configuration file from
a template.  Previously, the default configuration file generated by
`initdb` was sufficient, but in order to enable SSL connections, some
changes to it are required.

Naturally, SSL connections require a server certificate, so the
*postgresql-server* role will now also copy certificate files to the
managed node, if any.
2020-07-14 10:52:25 -05:00
Dustin afe4fb7eff roles/postgresql-server: Deploy PostgreSQL
The *postgresql-server* role installs and configures PostgreSQL on
Fedora/RHEL-based distributions.
2018-04-14 15:23:44 -05:00