add Ubuntu 20.04 support

This commit is contained in:
ace 2023-03-15 12:26:09 +03:00
parent 9207b91282
commit f753c5d1af
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
5 changed files with 35 additions and 0 deletions

View File

@ -3,6 +3,7 @@ Setup standalone PostgreSQL
Tested with OS: Tested with OS:
- AlmaLinux 8/9 - AlmaLinux 8/9
- Debian 11 - Debian 11
- Ubuntu 20.04
Supported PostgreSQL versions: Supported PostgreSQL versions:
- 13 - 13

View File

@ -1,4 +1,11 @@
--- ---
- name: Create data directory
file:
path: "{{ postgresql_data_dir }}"
owner: "postgres"
group: "postgres"
state: directory
- name: Merge user options for PostgreSQL config - name: Merge user options for PostgreSQL config
set_fact: set_fact:
postgresql_combined_parameters: "{{ postgresql_default_parameters | combine(postgresql_custom_parameters|default({}), recursive=true) }}" postgresql_combined_parameters: "{{ postgresql_default_parameters | combine(postgresql_custom_parameters|default({}), recursive=true) }}"

View File

@ -7,7 +7,9 @@
params: params:
files: files:
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml" - "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
- "{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml" - "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yaml"
- "{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yaml"
paths: paths:
- "vars" - "vars"
tags: postgresql_vars tags: postgresql_vars

View File

@ -34,6 +34,7 @@
- name: Include PostgreSQL configuration - name: Include PostgreSQL configuration
vars: vars:
postgresql_archive_command: "cd ."
postgresql_restore_command: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' wal-fetch %f %p' }}" postgresql_restore_command: "{{ postgresql_wal_g_binary_name ~ ' --config ' ~ postgresql_home_dir ~ '/' ~ postgresql_wal_g_restore_config_name ~ ' wal-fetch %f %p' }}"
include_tasks: config.yaml include_tasks: config.yaml

24
vars/Ubuntu-20.04.yaml Normal file
View File

@ -0,0 +1,24 @@
postgresql_apt_key:
- name: org.postgresql.gpg
url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
keyring: /etc/apt/trusted.gpg.d/org.postgresql.gpg
postgresql_apt_repository:
- repo: deb http://apt.postgresql.org/pub/repos/apt {{ ansible_distribution_release }}-pgdg main
filename: postgresql
postgresql_deps_packages:
- gnupg
- python3-psycopg2
postgresql_package_name: "postgresql-{{ postgresql_major_version }}"
postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}"
postgresql_version_build: "1.pgdg20.04+1"
postgresql_config_dir: "/etc/postgresql"
postgresql_home_dir: "/var/lib/postgresql"
postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
postgresql_ssl_path: "{{ postgresql_config_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"
postgresql_package_name_regex: "{{ postgresql_package_name }}-{{ postgresql_version }}-{{ postgresql_version_build }}"
postgresql_cluster_name: "main"
postgresql_ssl_update_ca_command: "update-ca-certificates --fresh"
postgresql_ssl_ca_trust_dir: "/usr/local/share/ca-certificates"
postgresql_unit_name: "postgresql@{{ postgresql_major_version}}-{{ postgresql_cluster_name }}"