diff --git a/tasks/Debian/install.yaml b/tasks/Debian/install.yaml index 30ea509..145522f 100644 --- a/tasks/Debian/install.yaml +++ b/tasks/Debian/install.yaml @@ -1,8 +1,10 @@ -- name: Install deps packages +- name: Install apt-transport-https and gnupg apt: - name: "{{ postgresql_deps_packages }}" - state: present + name: + - apt-transport-https + - gnupg update_cache: yes + state: present - name: Add gpg keys for PostgreSQL repo ansible.builtin.apt_key: @@ -20,6 +22,12 @@ loop: "{{ postgresql_apt_repository }}" when: postgresql_install_official_repo +- name: Install deps packages + apt: + name: "{{ postgresql_deps_packages }}" + state: present + update_cache: yes + - name: Install postgresql-common apt: name: postgresql-common diff --git a/tasks/Debian/main.yaml b/tasks/Debian/main.yaml index 8eb495a..879d0df 100644 --- a/tasks/Debian/main.yaml +++ b/tasks/Debian/main.yaml @@ -6,6 +6,16 @@ include_tasks: config.yaml tags: postgresql_configuration +- name: Include WAL-G role + ansible.builtin.include_role: + name: wal-g + 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 + - name: "PostgreSQL initdb" become_user: "{{ postgresql_superuser_username }}" shell: "/usr/lib/postgresql/{{ postgresql_major_version }}/bin/initdb -D {{ postgresql_data_dir }} --auth-local peer --auth-host {{ postgresql_password_encryption_algorithm }} --no-instructions" diff --git a/tasks/RedHat/main.yaml b/tasks/RedHat/main.yaml index 3300cb8..3b163f1 100644 --- a/tasks/RedHat/main.yaml +++ b/tasks/RedHat/main.yaml @@ -1,8 +1,3 @@ -- name: Install deps packages - dnf: - name: "{{ postgresql_deps_packages }}" - state: present - - name: Disable PostgreSQL module shell: dnf module disable -y postgresql register: disable_postgresql_module @@ -24,6 +19,11 @@ disable_gpg_check: yes register: postgresql_setup +- name: Install deps packages + dnf: + name: "{{ postgresql_deps_packages }}" + state: present + - name: Include data direcory include_tasks: data_dir.yaml diff --git a/vars/Debian-11.yaml b/vars/Debian-11.yaml index e14edac..a45a937 100644 --- a/vars/Debian-11.yaml +++ b/vars/Debian-11.yaml @@ -8,11 +8,11 @@ postgresql_apt_repository: postgresql_deps_packages: - gnupg - - python3-psycopg2 + - python3-psycopg2=*pgdg{{ ansible_distribution_version }}0+1 postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" -postgresql_version_build: "1.pgdg110+1" +postgresql_version_build: "1.pgdg{{ ansible_distribution_version}}0+1" postgresql_config_dir: "/etc/postgresql" postgresql_home_dir: "/var/lib/postgresql" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" diff --git a/vars/Ubuntu-20.04.yaml b/vars/Ubuntu-20.04.yaml index ef729de..b84d7da 100644 --- a/vars/Ubuntu-20.04.yaml +++ b/vars/Ubuntu-20.04.yaml @@ -8,11 +8,11 @@ postgresql_apt_repository: postgresql_deps_packages: - gnupg - - python3-psycopg2 + - python3-psycopg2=*~pgdg{{ ansible_distribution_version }}+1 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_version_build: "1.pgdg{{ ansible_distribution_version }}+1" postgresql_config_dir: "/etc/postgresql" postgresql_home_dir: "/var/lib/postgresql" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" diff --git a/vars/Ubuntu-22.04.yaml b/vars/Ubuntu-22.04.yaml index f0d5f36..b84d7da 100644 --- a/vars/Ubuntu-22.04.yaml +++ b/vars/Ubuntu-22.04.yaml @@ -8,11 +8,11 @@ postgresql_apt_repository: postgresql_deps_packages: - gnupg - - python3-psycopg2 + - python3-psycopg2=*~pgdg{{ ansible_distribution_version }}+1 postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" -postgresql_version_build: "1.pgdg22.04+1" +postgresql_version_build: "1.pgdg{{ ansible_distribution_version }}+1" postgresql_config_dir: "/etc/postgresql" postgresql_home_dir: "/var/lib/postgresql" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"