mirror of
https://gitea.0xace.cc/ansible-galaxy/postgresql.git
synced 2025-06-29 02:13:06 +00:00
refactor, add postgresql 16 as supported and fix pitr
This commit is contained in:
@ -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
|
||||
|
13
tasks/Debian/data_dir.yaml
Normal file
13
tasks/Debian/data_dir.yaml
Normal 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
|
@ -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"
|
||||
|
Reference in New Issue
Block a user