refactor, add postgresql 16 as supported and fix pitr

This commit is contained in:
ace
2024-05-26 17:56:35 +03:00
parent 0b74982f90
commit b6e14c2de3
8 changed files with 87 additions and 48 deletions

View File

@ -1,18 +1,4 @@
---
- name: Create data directory
file:
path: "{{ postgresql_data_dir }}"
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
state: directory
- name: Create configuration directory
file:
path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
state: directory
- name: Merge user options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_default_parameters | combine(postgresql_custom_parameters|default({}), recursive=true) }}"
@ -25,6 +11,13 @@
set_fact:
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_parameters, recursive=true) }}"
- name: Merge PITR restore options for PostgreSQL config
set_fact:
postgresql_combined_parameters: "{{ postgresql_combined_parameters | combine(postgresql_restore_pitr_parameters, recursive=true) }}"
when:
- postgresql_wal_g_restore_from_backup
- postgresql_wal_g_pitr | length > 0
- name: Propagate PostgreSQL configs
block:
- name: Template PostgreSQL pg_hba configuration

View File

@ -0,0 +1,13 @@
- name: Create data directory
file:
path: "{{ postgresql_data_dir }}"
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
state: directory
- name: Create configuration directory
file:
path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
owner: "{{ postgresql_user }}"
group: "{{ postgresql_group }}"
state: directory

View File

@ -2,9 +2,8 @@
include_tasks: install.yaml
tags: postgresql_installation
- name: "Configure PostgreSQL"
include_tasks: config.yaml
tags: postgresql_configuration
- name: Include data direcory
include_tasks: data_dir.yaml
- name: "Manage TLS/SSL certificates"
#include_tasks: cacert.yaml
@ -25,6 +24,10 @@
include_tasks: restore.yaml
when: postgresql_wal_g_restore_from_backup
- name: "Configure PostgreSQL"
include_tasks: config.yaml
tags: postgresql_configuration
- name: "PostgreSQL initdb"
become_user: "{{ postgresql_superuser_username }}"
shell: "/usr/lib/postgresql/{{ postgresql_major_version }}/bin/initdb -D {{ postgresql_data_dir }} --username {{ postgresql_superuser_username }} --auth-local peer --auth-host {{ postgresql_password_encryption_algorithm }} --no-instructions"