mirror of
https://gitea.0xace.cc/ansible-galaxy/postgresql.git
synced 2025-12-18 21:27:25 +00:00
add rhel 9 and debian 11 support
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user