From f753c5d1af3b24231e64cac12b242fab0ff838d6 Mon Sep 17 00:00:00 2001 From: ace Date: Wed, 15 Mar 2023 12:26:09 +0300 Subject: [PATCH] add Ubuntu 20.04 support --- README.md | 1 + tasks/Debian/config.yaml | 7 +++++++ tasks/main.yaml | 2 ++ tasks/restore.yaml | 1 + vars/Ubuntu-20.04.yaml | 24 ++++++++++++++++++++++++ 5 files changed, 35 insertions(+) create mode 100644 vars/Ubuntu-20.04.yaml diff --git a/README.md b/README.md index f9d1976..5d2dad3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Setup standalone PostgreSQL Tested with OS: - AlmaLinux 8/9 - Debian 11 + - Ubuntu 20.04 Supported PostgreSQL versions: - 13 diff --git a/tasks/Debian/config.yaml b/tasks/Debian/config.yaml index bdc0c1a..0278c10 100644 --- a/tasks/Debian/config.yaml +++ b/tasks/Debian/config.yaml @@ -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 set_fact: postgresql_combined_parameters: "{{ postgresql_default_parameters | combine(postgresql_custom_parameters|default({}), recursive=true) }}" diff --git a/tasks/main.yaml b/tasks/main.yaml index e1ce9d1..ad11782 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -7,7 +7,9 @@ params: files: - "{{ 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_version'] }}.yaml" paths: - "vars" tags: postgresql_vars diff --git a/tasks/restore.yaml b/tasks/restore.yaml index 0a83ada..c09565b 100644 --- a/tasks/restore.yaml +++ b/tasks/restore.yaml @@ -34,6 +34,7 @@ - name: Include PostgreSQL configuration 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' }}" include_tasks: config.yaml diff --git a/vars/Ubuntu-20.04.yaml b/vars/Ubuntu-20.04.yaml new file mode 100644 index 0000000..ef729de --- /dev/null +++ b/vars/Ubuntu-20.04.yaml @@ -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 }}"