Skip to content

Commit 8536c1c

Browse files
committed
fix: add support for EL10
According to the Ansible team, support for listing platforms in role `meta/main.yml` files is being removed. Instead, they recommend using `galaxy_tags` https://github.com/ansible/ansible/blob/stable-2.17/changelogs/CHANGELOG-v2.17.rst "Remove the galaxy_info field platforms from the role templates" ansible/ansible#82453 Many roles already have tags such as "rhel", "redhat", "centos", and "fedora". I propose that we ensure all of the system roles have these tags. Some of our roles support Suse, Debian, Ubuntu, and others. We should add tags for those e.g. the ssh role already has tags for "debian" and "ubuntu". In addition - for each version listed under `platforms.EL` - add a tag like `elN`. Q: Why not use a delimiter between the platform and the version e.g. `el-10`? This is not allowed by ansible-lint: ``` meta-no-tags: Tags must contain lowercase letters and digits only., invalid: 'el-10' meta/main.yml:1 ``` So we cannot use uppercase letters either. Q: Why not use our own meta/main.yml field? No other fields are allowed by ansible-lint: ``` syntax-check[specific]: 'myfield' is not a valid attribute for a RoleMetadata ``` Q: Why not use some other field? There are no other applicable or suitable fields. Q: What happens when we want to support versions like `N.M`? Use the word "dot" instead of "." e.g. `el10dot3`. Similarly - use "dash" instead of "-". We do not need tags such as `fedoraall`. The `fedora` tag implies that the role works on all supported versions of fedora. Otherwise, use tags such as `fedora40` if the role only supports specific versions. In addition - for roles that have different variable files for EL9, create the corresponding EL10 files. Added variables for el10. Looks like the default version on el10 is 16. No other versions (yet). Signed-off-by: Rich Megginson <[email protected]>
1 parent f63c30c commit 8536c1c

File tree

9 files changed

+39
-3
lines changed

9 files changed

+39
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgresql-server
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgresql-server

defaults/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
# This file also serves as a documentation for such a variables.
55

66
# Examples of role input variables:
7-
postgresql_version: "13"
7+
postgresql_version: "{{ '16' if ansible_facts['os_family'] == 'RedHat'
8+
and ansible_facts['distribution'] != 'Fedora'
9+
and ansible_facts['distribution_major_version'] == '10'
10+
else '13' }}"
811
postgresql_password: null
912
postgresql_cert_name: null
1013
postgresql_server_tuning: true

meta/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ galaxy_info:
1414
versions:
1515
- "8"
1616
- "9"
17-
galaxy_tags: [database, postgresql]
17+
galaxy_tags:
18+
- database
19+
- el8
20+
- el9
21+
- el10
22+
- fedora
23+
- postgresql
1824
dependencies: []

tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
- ansible_facts["distribution_major_version"] == "9"
2525
- postgresql_version | string not in __postgresql_versions_el9
2626

27+
- name: Check if requested version is supported in system (RHEL10)
28+
fail:
29+
msg: >-
30+
RHEL 10 supports only Postgresql versions
31+
{{ __postgresql_versions_el10 | join(",") }}
32+
when:
33+
- ansible_facts["os_family"] == "RedHat"
34+
- ansible_facts["distribution_major_version"] == "10"
35+
- postgresql_version | string not in __postgresql_versions_el10
36+
2737
- name: Check requested and installed version of Postgresql
2838
fail:
2939
msg: >-

tests/tests_versions.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- name: Skip test if distro does not support multiple versions
88
meta: end_host
99
when: ansible_facts['distribution'] not in ['CentOS', 'RedHat'] or
10-
ansible_facts['distribution_major_version'] not in ["8", "9"]
10+
ansible_facts['distribution_major_version'] not in ["8", "9", "10"]
1111

1212
- name: Install and cleanup default version
1313
include_tasks: tasks/install_and_check.yml
@@ -33,6 +33,8 @@
3333
if ansible_facts['distribution_major_version'] == '8'
3434
else __postgresql_versions_el9
3535
if ansible_facts['distribution_major_version'] == '9'
36+
else __postgresql_versions_el10
37+
if ansible_facts['distribution_major_version'] == '10'
3638
else [] }}"
3739
__unsuppported_versions: "{{ ['16']
3840
if ansible_facts['distribution'] == 'RedHat' and

vars/CentOS_10.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: MIT
2+
---
3+
__postgresql_packages: >-
4+
{{ ['@postgresql:' + postgresql_version +
5+
'/server'] if postgresql_version != '16' else
6+
['postgresql-server'] }}

vars/RedHat_10.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: MIT
2+
---
3+
__postgresql_packages: >-
4+
{{ ['@postgresql:' + postgresql_version +
5+
'/server'] if postgresql_version != '16' else
6+
['postgresql-server'] }}

vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
__postgresql_packages: [postgresql-server]
99
__postgresql_versions_el8: ["10", "12", "13", "15", "16"]
1010
__postgresql_versions_el9: ["13", "15", "16"]
11+
__postgresql_versions_el10: ["16"]
1112

1213
__postgresql_data_dir: /var/lib/pgsql/data
1314

0 commit comments

Comments
 (0)