This PR includes a refactoring of the Ansible playbook that manages PostgreSQL's WAL directory, as well as an update to the Patroni configuration template.
Main Changes:
Refactoring the Ansible playbook for managing Postgresql WAL:
Defined the name of the base WAL directory at the start of the script. This improves readability and simplifies the handling of the variable later in the script.
Updated the WAL synchronization block. Now, it first ensures the custom WAL directory exists and is empty. Execute CHECKPOINT before stopping PostgreSQL.
Modified the order of certain actions to enhance script reliability.
Updating the Patroni configuration template:
Removed the PostgreSQL version check and the condition for defining waldir in the template.
Added a new option In 'basebackup' variable which allows users to specify 'waldir' setting. By default, this option is disabled.
Additional tag added for point-in-time recovery operations:
An extra tag point_in_time_recovery has been introduced for tasks in custom_wall_dir.yml. This tag allows the execution of these tasks specifically after restore from backup to ensure that a symlink to a separate WAL directory set up after the recovery.
Added molecule test for custom PostgreSQL data and WAL directory.
It makes sense when custom paths are set in the variables postgresql_data_dir and postgresql_wal_dir
This test verifies that our setup can accommodate non-standard directory paths and supports relocating the WAL directory to a separate disk (using a symlink).
These changes will make the playbook more robust and user-friendly for configuration and maintenance.
This PR includes a refactoring of the Ansible playbook that manages PostgreSQL's WAL directory, as well as an update to the Patroni configuration template.
Main Changes:
point_in_time_recovery
has been introduced for tasks incustom_wall_dir.yml
. This tag allows the execution of these tasks specifically after restore from backup to ensure that a symlink to a separate WAL directory set up after the recovery.postgresql_data_dir
andpostgresql_wal_dir
These changes will make the playbook more robust and user-friendly for configuration and maintenance.