2023-02-09 21:49:13 +00:00
|
|
|
- name: "Install PostgreSQL"
|
|
|
|
include_tasks: install.yaml
|
|
|
|
tags: postgresql_installation
|
|
|
|
|
2024-05-26 14:56:35 +00:00
|
|
|
- name: Include data direcory
|
|
|
|
include_tasks: data_dir.yaml
|
2023-02-09 21:49:13 +00:00
|
|
|
|
2023-07-21 14:14:47 +00:00
|
|
|
- name: "Manage TLS/SSL certificates"
|
2024-03-19 11:05:41 +00:00
|
|
|
#include_tasks: cacert.yaml
|
|
|
|
include_tasks: ssl/main.yaml
|
2023-07-21 14:14:47 +00:00
|
|
|
when: postgresql_ssl
|
|
|
|
|
2023-04-18 21:10:38 +00:00
|
|
|
- name: Include WAL-G role
|
|
|
|
ansible.builtin.include_role:
|
2024-05-15 12:51:26 +00:00
|
|
|
name: wal-g-pg
|
2023-04-18 21:10:38 +00:00
|
|
|
vars:
|
|
|
|
wal_g_pg: yes
|
|
|
|
wal_g_pg_home_dir: "{{ postgresql_home_dir }}"
|
|
|
|
wal_g_pg_data_dir: "{{ postgresql_data_dir }}"
|
|
|
|
wal_g_restore: "{{ postgresql_wal_g_restore }}"
|
|
|
|
when: postgresql_wal_g_install
|
|
|
|
|
2023-07-21 14:14:47 +00:00
|
|
|
- name: Include PostgreSQL restore
|
|
|
|
include_tasks: restore.yaml
|
|
|
|
when: postgresql_wal_g_restore_from_backup
|
|
|
|
|
2024-05-26 14:56:35 +00:00
|
|
|
- name: "Configure PostgreSQL"
|
|
|
|
include_tasks: config.yaml
|
|
|
|
tags: postgresql_configuration
|
|
|
|
|
2023-02-09 21:49:13 +00:00
|
|
|
- name: "PostgreSQL initdb"
|
2023-02-17 15:13:08 +00:00
|
|
|
become_user: "{{ postgresql_superuser_username }}"
|
2023-06-13 18:29:53 +00:00
|
|
|
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"
|
2023-02-09 21:49:13 +00:00
|
|
|
register: initdb
|
|
|
|
changed_when: "'exists but is not empty' not in initdb.stderr"
|
|
|
|
failed_when: false
|