add rhel 9 and debian 11 support

This commit is contained in:
ace
2023-02-10 00:49:13 +03:00
parent 598b5c44a5
commit 187120291a
18 changed files with 285 additions and 92 deletions

View File

@@ -1,37 +1,14 @@
- name: Add gpg package
apt:
name: gpg
- name: "Install PostgreSQL"
include_tasks: install.yaml
tags: postgresql_installation
- name: Add gpg keys for postgresql
ansible.builtin.apt_key:
url: "{{ item.url }}"
keyring: "{{ item.keyring }}"
loop: "{{ postgresql_apt_key }}"
- name: "Configure PostgreSQL"
include_tasks: config.yaml
tags: postgresql_configuration
- name: Add Hashicorp repository
apt_repository:
repo: "{{ item.repo }}"
state: present
filename: "{{ item.filename }}"
update_cache: yes
loop: "{{ postgresql_apt_repository }}"
- name: Check if Patroni is installed
ansible.builtin.shell: dpkg-query -l {{ postgresql_package_name }} 2>&1 | grep {{ postgresql_version }}
ignore_errors: True
register: is_postgresql
changed_when: is_postgresql.rc != 0
failed_when: False
- name: Mask Patroni before install
ansible.builtin.systemd:
name: "{{ postgresql_package_name }}"
masked: yes
when: is_postgresql.rc != 0
- name: "Install {{ postgresql_package_name }} {{ postgresql_version }}"
apt:
name: "{{ postgresql_package }}"
update_cache: yes
register: postgresql_setup
when: is_postgresql.rc != 0
- name: "PostgreSQL initdb"
become_user: "{{ postgresql_superuser_name }}"
shell: "/usr/lib/postgresql/{{ postgresql_major_version }}/bin/initdb -D {{ postgresql_data_dir }} --auth-local peer --auth-host {{ postgresql_password_encryption_algorithm }} --no-instructions"
register: initdb
changed_when: "'exists but is not empty' not in initdb.stderr"
failed_when: false