Skip to content

Commit 915a9ea

Browse files
committed
drop Python 2 support
Due to Python 3 being the default in all supported OSs, we may remove the logic that dealt with detecting the OSs Python version and consequently installed a different set of packages. - removed dependency on Python 2 packages (python-psycopg2) - rephrased named steps in CI as it is explicitely set in `python-version` - require Ansible 2.12 as it supports the auto-detection of the OS Python interpreter - removed explicit setting of Python version in variables, playbooks and inventory - removed unsupported configurations from test inventory
1 parent a389942 commit 915a9ea

20 files changed

+6
-44
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
path: 'postgresql'
2828

29-
- name: Set up Python 3.
29+
- name: Set up Python.
3030
uses: actions/setup-python@v5
3131
with:
3232
python-version: '3.x'
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
path: 'postgresql'
5959

60-
- name: Set up Python 3.
60+
- name: Set up Python.
6161
uses: actions/setup-python@v5
6262
with:
6363
python-version: '3.x'

defaults/main.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,6 @@ postgresql_yum_repository_gpgkey: "{{ postgresql_pgdg_repository_url }}/keys/PGD
830830
postgresql_dnf_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
831831
postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}"
832832

833-
postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"]
834-
postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"]
835-
postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 'python3' in ansible_python_interpreter|default('') else postgresql_apt_py2_dependencies }}"
833+
postgresql_apt_dependencies: ["python3-psycopg2", "locales"]
836834

837835
postgresql_hide_passwords: false

meta/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ galaxy_info:
66
namespace: anxs
77
role_name: postgresql
88
description: "Install and configure PostgreSQL, dependencies, extensions, databases and users."
9-
min_ansible_version: 2.4.0
9+
min_ansible_version: 2.12.0
1010
license: MIT
1111

1212
platforms:

tests/docker/hosts

-2
This file was deleted.

tests/docker/site.yml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
name: "postgresql-{{ item }}"
2929
ansible_connection: docker
3030
ansible_user: root
31-
ansible_python_interpreter: python
3231
groups: postgresql
3332
postgresql_version: "{{ item }}"
3433
changed_when: false

tests/vars.CentOS.7.yml

-3
This file was deleted.

tests/vars.CentOS.8.yml

-3
This file was deleted.

tests/vars.CentOS.9.yml

-3
This file was deleted.

tests/vars.Debian.10.yml

-3
This file was deleted.

tests/vars.Debian.11.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
---
2-
#--- picking the correct python interpreter
3-
ansible_python_interpreter: "/usr/bin/python3"

tests/vars.Debian.12.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
---
2-
#--- picking the correct python interpreter
3-
ansible_python_interpreter: "/usr/bin/python3"

tests/vars.Debian.9.yml

-3
This file was deleted.

tests/vars.Debian.yml

-3
This file was deleted.

tests/vars.Fedora.37.yml

-3
This file was deleted.

tests/vars.Fedora.40.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---

tests/vars.Ubuntu.16.yml

-3
This file was deleted.

tests/vars.Ubuntu.18.yml

-3
This file was deleted.

tests/vars.Ubuntu.20.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
---
2-
#--- picking the correct python interpreter
3-
ansible_python_interpreter: "/usr/bin/python3"

tests/vars.Ubuntu.22.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
---
2-
#--- picking the correct python interpreter
3-
ansible_python_interpreter: "/usr/bin/python3"

tests/vars.Ubuntu.24.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---

0 commit comments

Comments
 (0)