fix deps installation and add wal-g support

This commit is contained in:
ace 2023-04-19 00:10:38 +03:00
parent 2ea9e25263
commit 8ec959cf73
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
6 changed files with 32 additions and 14 deletions

View File

@ -1,8 +1,10 @@
- name: Install deps packages - name: Install apt-transport-https and gnupg
apt: apt:
name: "{{ postgresql_deps_packages }}" name:
state: present - apt-transport-https
- gnupg
update_cache: yes update_cache: yes
state: present
- name: Add gpg keys for PostgreSQL repo - name: Add gpg keys for PostgreSQL repo
ansible.builtin.apt_key: ansible.builtin.apt_key:
@ -20,6 +22,12 @@
loop: "{{ postgresql_apt_repository }}" loop: "{{ postgresql_apt_repository }}"
when: postgresql_install_official_repo when: postgresql_install_official_repo
- name: Install deps packages
apt:
name: "{{ postgresql_deps_packages }}"
state: present
update_cache: yes
- name: Install postgresql-common - name: Install postgresql-common
apt: apt:
name: postgresql-common name: postgresql-common

View File

@ -6,6 +6,16 @@
include_tasks: config.yaml include_tasks: config.yaml
tags: postgresql_configuration 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" - name: "PostgreSQL initdb"
become_user: "{{ postgresql_superuser_username }}" 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" shell: "/usr/lib/postgresql/{{ postgresql_major_version }}/bin/initdb -D {{ postgresql_data_dir }} --auth-local peer --auth-host {{ postgresql_password_encryption_algorithm }} --no-instructions"

View File

@ -1,8 +1,3 @@
- name: Install deps packages
dnf:
name: "{{ postgresql_deps_packages }}"
state: present
- name: Disable PostgreSQL module - name: Disable PostgreSQL module
shell: dnf module disable -y postgresql shell: dnf module disable -y postgresql
register: disable_postgresql_module register: disable_postgresql_module
@ -24,6 +19,11 @@
disable_gpg_check: yes disable_gpg_check: yes
register: postgresql_setup register: postgresql_setup
- name: Install deps packages
dnf:
name: "{{ postgresql_deps_packages }}"
state: present
- name: Include data direcory - name: Include data direcory
include_tasks: data_dir.yaml include_tasks: data_dir.yaml

View File

@ -8,11 +8,11 @@ postgresql_apt_repository:
postgresql_deps_packages: postgresql_deps_packages:
- gnupg - gnupg
- python3-psycopg2 - python3-psycopg2=*pgdg{{ ansible_distribution_version }}0+1
postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package_name: "postgresql-{{ postgresql_major_version }}"
postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" 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_config_dir: "/etc/postgresql"
postgresql_home_dir: "/var/lib/postgresql" postgresql_home_dir: "/var/lib/postgresql"
postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"

View File

@ -8,11 +8,11 @@ postgresql_apt_repository:
postgresql_deps_packages: postgresql_deps_packages:
- gnupg - gnupg
- python3-psycopg2 - python3-psycopg2=*~pgdg{{ ansible_distribution_version }}+1
postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package_name: "postgresql-{{ postgresql_major_version }}"
postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" 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_config_dir: "/etc/postgresql"
postgresql_home_dir: "/var/lib/postgresql" postgresql_home_dir: "/var/lib/postgresql"
postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"

View File

@ -8,11 +8,11 @@ postgresql_apt_repository:
postgresql_deps_packages: postgresql_deps_packages:
- gnupg - gnupg
- python3-psycopg2 - python3-psycopg2=*~pgdg{{ ansible_distribution_version }}+1
postgresql_package_name: "postgresql-{{ postgresql_major_version }}" postgresql_package_name: "postgresql-{{ postgresql_major_version }}"
postgresql_package: "{{ postgresql_package_name }}={{ postgresql_version }}-{{ postgresql_version_build }}" 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_config_dir: "/etc/postgresql"
postgresql_home_dir: "/var/lib/postgresql" postgresql_home_dir: "/var/lib/postgresql"
postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}" postgresql_data_dir: "{{ postgresql_home_dir }}/{{ postgresql_major_version }}/{{ postgresql_cluster_name }}"