Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ostree/packages-runtime-CentOS-10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
postgresql-server
1 change: 1 addition & 0 deletions .ostree/packages-runtime-RedHat-10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
postgresql-server
5 changes: 4 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
# This file also serves as a documentation for such a variables.

# Examples of role input variables:
postgresql_version: "13"
postgresql_version: "{{ '16' if ansible_facts['os_family'] == 'RedHat'
and ansible_facts['distribution'] != 'Fedora'
and ansible_facts['distribution_major_version'] == '10'
else '13' }}"
postgresql_password: null
postgresql_cert_name: null
postgresql_server_tuning: true
Expand Down
8 changes: 7 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ galaxy_info:
versions:
- "8"
- "9"
galaxy_tags: [database, postgresql]
galaxy_tags:
- database
- el8
- el9
- el10
- fedora
- postgresql
dependencies: []
10 changes: 10 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
- ansible_facts["distribution_major_version"] == "9"
- postgresql_version | string not in __postgresql_versions_el9

- name: Check if requested version is supported in system (RHEL10)
fail:
msg: >-
RHEL 10 supports only Postgresql versions
{{ __postgresql_versions_el10 | join(",") }}
when:
- ansible_facts["os_family"] == "RedHat"
- ansible_facts["distribution_major_version"] == "10"
- postgresql_version | string not in __postgresql_versions_el10

- name: Check requested and installed version of Postgresql
fail:
msg: >-
Expand Down
4 changes: 3 additions & 1 deletion tests/tests_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: Skip test if distro does not support multiple versions
meta: end_host
when: ansible_facts['distribution'] not in ['CentOS', 'RedHat'] or
ansible_facts['distribution_major_version'] not in ["8", "9"]
ansible_facts['distribution_major_version'] not in ["8", "9", "10"]

- name: Install and cleanup default version
include_tasks: tasks/install_and_check.yml
Expand All @@ -33,6 +33,8 @@
if ansible_facts['distribution_major_version'] == '8'
else __postgresql_versions_el9
if ansible_facts['distribution_major_version'] == '9'
else __postgresql_versions_el10
if ansible_facts['distribution_major_version'] == '10'
else [] }}"
__unsuppported_versions: "{{ ['16']
if ansible_facts['distribution'] == 'RedHat' and
Expand Down
6 changes: 6 additions & 0 deletions vars/CentOS_10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: MIT
---
__postgresql_packages: >-
{{ ['@postgresql:' + postgresql_version +
'/server'] if postgresql_version != '16' else
['postgresql-server'] }}
6 changes: 6 additions & 0 deletions vars/RedHat_10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: MIT
---
__postgresql_packages: >-
{{ ['@postgresql:' + postgresql_version +
'/server'] if postgresql_version != '16' else
['postgresql-server'] }}
1 change: 1 addition & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
__postgresql_packages: [postgresql-server]
__postgresql_versions_el8: ["10", "12", "13", "15", "16"]
__postgresql_versions_el9: ["13", "15", "16"]
__postgresql_versions_el10: ["16"]

__postgresql_data_dir: /var/lib/pgsql/data

Expand Down