diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52e3c83..ececa1f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,24 +8,23 @@ name: test jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: platform: - rockylinux9 - - rockylinux8 + # - rockylinux8 - centos-stream10 - centos-stream9 - # - fedora41 + - fedora41 - fedora40 - fedora39 - ubuntu2404 - ubuntu2204 - ubuntu2004 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 - run: | python3 -m pip install --upgrade pip python3 -m pip install tox diff --git a/README.md b/README.md index f4c28b6..6858515 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ waco_python An opinionated Ansible role that allows you to perform system and/or source Python installations and to complement them by creating custom virtualenv's and installing Ansible, Mercurial or Sphinx. Supported distributions are the currently maintained releases of the Red Hat family and -derivatives, and of the Ubuntu LTS variants. At this time tests are run on Rocky Linux 8, CentOS 7, -Fedora 35, Fedora 34, Ubuntu 20.04 and Ubuntu 18.04. +derivatives, and of the Ubuntu LTS variants. At this time tests are run on Rocky Linux 9, CentOS Stream 10, +CentOS Stream 9, Fedora 41, Fedora 40, Fedora 39, Ubuntu 24.04, Ubuntu 22.04 and Ubuntu 20.04. Requirements @@ -40,7 +40,7 @@ Whether to install Sphinx, in a specific virtualenv based on the latest Python v Owner and group of source Python installations. - wapy_source_versions: [ 3.10.1 ] + wapy_source_versions: [ 3.13.1 ] The Python source releases to be installed. @@ -114,7 +114,7 @@ with the [waco-master](https://github.com/waco-org/waco-master) role. - role: waco_org.waco_python vars: wapy_source_versions: - - 3.10.1 + - 3.13.1 wapy_has_sphinx: true License diff --git a/defaults/main.yml b/defaults/main.yml index 9fe38ca..1de76f6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- # Workstation as Code -# Copyright Nicola Musatti 2020 - 2022. +# Copyright Nicola Musatti 2020 - 2025. wapy_has_ansible: false wapy_has_mercurial: false @@ -8,15 +8,16 @@ wapy_has_sphinx: false wapy_user: python wapy_group: "{{ wapy_user }}" wapy_source_versions: - - 3.10.6 - # - 3.9.13 - # - 3.8.13 - # - 3.7.13 - # - 3.6.15 - # - 2.7.18 + - 3.13.1 + # - 3.12.8 + # - 3.11.11 + # - 3.10.16 + # - 3.9.21 + # - 3.8.20 + # - 3.7.17 wapy_build_root_dir: "/sw" wapy_install_root_dir: "/opt" -# wapy_pip_version: 20.3.1 +# wapy_pip_version: 24.3.1 wapy_source_packages: - ipython - pip @@ -36,6 +37,7 @@ wapy_source_venv_packages: - six - tox - twine + - virtualenv - wheel wapy_system_venv_root_dir: "/opt" wapy_system_venv_prefix: "sysvenv" @@ -44,7 +46,8 @@ wapy_ansible_packages: - ansible - ansible-lint - flake8 - - molecule[docker,lint] + - molecule + - molecule-plugins[docker] - pytest - selinux - pytest-testinfra diff --git a/meta/main.yml b/meta/main.yml index 59a12c8..7099148 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,6 @@ --- # Workstation as Code -# Copyright Nicola Musatti 2020 - 2022. +# Copyright Nicola Musatti 2020 - 2025. galaxy_info: role_name: waco_python @@ -10,24 +10,22 @@ galaxy_info: company: The Waco project license: GPLv3 - - min_ansible_version: "2.10" - + min_ansible_version: "2.17" platforms: - name: EL versions: - "9" - "8" - - "7" - name: Fedora versions: - - "36" - - "35" + - "41" + - "40" + - "39" - name: Ubuntu versions: + - noble - jammy - focal - - bionic galaxy_tags: [] diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 7d4eec3..3349dc1 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -5,7 +5,7 @@ - role: waco_org.waco_python vars: wapy_source_versions: - - "3.9.0" + - "3.13.1" wapy_has_ansible: true wapy_has_mercurial: true wapy_has_sphinx: true diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index 81ce37c..97f2509 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -25,23 +25,23 @@ def test_python2(host): def test_source_python(host): - f = host.file('/opt/Python-3.9/bin/python3.9') + f = host.file('/opt/Python-3.13/bin/python3.13') assert f.exists assert f.user == 'python' assert f.group == 'python' - assert '3.9.0' in host.check_output( - '/opt/Python-3.9/bin/python3.9 --version') + assert '3.13.1' in host.check_output( + '/opt/Python-3.13/bin/python3.13 --version') def test_venv_python(host): - f = host.file('/opt/venv-3.9/dev/bin/python3.9') + f = host.file('/opt/venv-3.13/dev/bin/python3.13') assert f.exists assert f.user == 'python' assert f.group == 'python' - assert '3.9.0' in host.check_output( - '/opt/venv-3.9/dev/bin/python3.9 --version') + assert '3.13.1' in host.check_output( + '/opt/venv-3.13/dev/bin/python3.13 --version') def test_ansible(host): diff --git a/tasks/main.yml b/tasks/main.yml index c463cd9..1dad6d7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- # Workstation as Code -# Copyright Nicola Musatti 2020 - 2023. +# Copyright Nicola Musatti 2020 - 2025. - name: Create the Python installation group ansible.builtin.group: @@ -13,59 +13,53 @@ group: "{{ wapy_group }}" become: true +- name: Install GnuPG 2 (EL 10) + ansible.builtin.dnf: + name: + - gnupg2 + state: present + become: true + when: wapy_platform in ('EL10') + - name: Enable the EPEL repository ansible.builtin.include_role: name: geerlingguy.repo-epel - when: wapy_platform in ('EL7', 'EL8', 'EL9') + when: wapy_platform in ('EL10', 'EL9', 'EL8') -- name: Install system Python (EL 9) - ansible.builtin.dnf: - name: - - python3 - state: present +- name: Check if the Code Ready Linux Builder repository is installed (EL 10, EL 9) + ansible.builtin.command: "crb status" become: true - when: wapy_platform in ('EL9') + register: crb + changed_when: false + when: wapy_platform in ('EL10', 'EL9') -- name: Install system Python (EL 8, Fedora) - ansible.builtin.dnf: - name: - - python2 - - python3 - state: present +- name: Enable the Code Ready Linux Builder repository (EL 10, EL 9) + ansible.builtin.command: "crb enable" become: true - when: wapy_platform in ('EL8', 'Fedora') + when: wapy_platform in ('EL10', 'EL9') and 'disabled' in crb.stdout -- name: Install system Python (EL 7) - ansible.builtin.yum: +- name: Install system Python + ansible.builtin.dnf: name: - - python2 - python3 state: present become: true - when: wapy_platform == 'EL7' + when: ansible_os_family == 'RedHat' - name: Install system Python (Ubuntu) ansible.builtin.apt: name: - - "{{ (ansible_distribution_version == '18.04') | ternary('python', 'python2') }}" - python3 state: present become: true when: wapy_platform == 'Ubuntu' -- name: "Install system Python dependencies (EL 9, EL 8, Fedora)" +- name: "Install system Python dependencies (EL 10, EL 9, EL 8, Fedora)" ansible.builtin.dnf: name: "{{ wapy_system_python_deps }}" state: present become: true - when: wapy_platform in ('EL9', 'EL8', 'Fedora') - -- name: "Install system Python dependencies (EL 7)" - ansible.builtin.yum: - name: "{{ wapy_system_python_deps }}" - state: present - become: true - when: wapy_platform == 'EL7' + when: wapy_platform in ('EL10', 'EL9', 'EL8', 'Fedora') - name: "Install system Python dependencies (Ubuntu)" ansible.builtin.apt: diff --git a/tasks/redhat/ansible_mercurial.yml b/tasks/redhat/ansible_mercurial.yml index 144b999..4e662d2 100644 --- a/tasks/redhat/ansible_mercurial.yml +++ b/tasks/redhat/ansible_mercurial.yml @@ -1,6 +1,6 @@ --- # Workstation as Code -# Copyright Nicola Musatti 2022 - 2023. +# Copyright Nicola Musatti 2022 - 2025. - name: "Register SELinux compatible source virtualenv tools" ansible.builtin.set_fact: @@ -16,8 +16,7 @@ ansible.builtin.set_fact: selinux_virtualenv_dir: "{{ wapy_system_venv_root_dir }}/{{ wapy_system_venv_prefix }}-{{ wapy_selinux_python_minor }}" - selinux_virtualenv_command: "/usr/bin/virtualenv{{ - (wapy_platform == 'Fedora') | ternary('', '-' + wapy_selinux_python_minor) }}" + selinux_virtualenv_command: "/usr/bin/virtualenv" selinux_virtualenv_python: "/usr/bin/python{{ wapy_selinux_python_minor }}" when: selinux_python_release is not defined @@ -39,27 +38,15 @@ become: true when: (wapy_has_ansible or wapy_has_mercurial or wapy_has_sphinx) and selinux_python_release is not defined -- name: Install Ansible and Molecule in a virtualenv (EL 7) +- name: Install Ansible and Molecule in a virtualenv ansible.builtin.pip: name: "{{ wapy_ansible_packages }}" virtualenv: "{{ selinux_virtualenv_dir }}/{{ wapy_ansible_venv }}" virtualenv_command: "{{ selinux_virtualenv_command }}" virtualenv_python: "{{ selinux_virtualenv_python }}" - environment: - LC_ALL: "en_US.UTF-8" become: true become_user: "{{ wapy_user }}" - when: wapy_has_ansible and wapy_platform == 'EL7' - -- name: Install Ansible and Molecule in a virtualenv (EL 8, Fedora) - ansible.builtin.pip: - name: "{{ wapy_ansible_packages }}" - virtualenv: "{{ selinux_virtualenv_dir }}/{{ wapy_ansible_venv }}" - virtualenv_command: "{{ selinux_virtualenv_command }}" - virtualenv_python: "{{ selinux_virtualenv_python }}" - become: true - become_user: "{{ wapy_user }}" - when: wapy_has_ansible and wapy_platform != 'EL7' + when: wapy_has_ansible - name: Install Mercurial in a virtualenv ansible.builtin.pip: diff --git a/tox.ini b/tox.ini index d498a41..e9a9f15 100644 --- a/tox.ini +++ b/tox.ini @@ -2,12 +2,12 @@ minversion=3.24 envlist = rockylinux9 - rockylinux8 - centos-stream10 - centos-stream9 - #fedora41 + # rockylinux8 + fedora41 fedora40 fedora39 + centos-stream10 + centos-stream9 ubuntu2404 ubuntu2204 ubuntu2004 @@ -16,16 +16,16 @@ skipsdist=true [testenv] deps = - ansible<2.17 + ansible ansible-compat ansible-lint molecule molecule-plugins[docker] - pytest - pytest-testinfra - rich - selinux<0.3.0 - yamllint + pytest + pytest-testinfra + rich + selinux + yamllint commands = molecule {posargs} diff --git a/vars/main.yml b/vars/main.yml index e83e6d0..f97d7c7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,41 +1,37 @@ --- # Workstation as Code -# Copyright Nicola Musatti 2020 - 2022. +# Copyright Nicola Musatti 2020 - 2025. wapy_platform: "{{ (ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora') | ternary('EL' + ansible_distribution_major_version, ansible_distribution) }}" wapy_platform_dependencies: - EL9: + EL10: - libjpeg-turbo-devel - libxml2-devel - libxslt-devel - python3-libselinux - python3-pip - python3-setuptools - # - python3-virtualenv - EL8: + - python3-virtualenv + EL9: - libjpeg-turbo-devel - libxml2-devel - libxslt-devel - - python2-pip - - python2-setuptools - - python2-virtualenv - python3-libselinux - python3-pip - python3-setuptools - python3-virtualenv - EL7: + EL8: - libjpeg-turbo-devel - - libselinux-python - - libselinux-python3 - libxml2-devel - libxslt-devel - - python-setuptools - - python-virtualenv - python2-pip + - python2-setuptools + - python2-virtualenv + - python3-libselinux - python3-pip - - python36-setuptools - - python36-virtualenv + - python3-setuptools + - python3-virtualenv Fedora: - libjpeg-turbo-devel - libxml2-devel @@ -48,22 +44,25 @@ wapy_platform_dependencies: - libjpeg-turbo8-dev - libxml2-dev - libxslt1-dev - - python-setuptools - python3-setuptools - python3-virtualenv - python3-pip wapy_system_python_deps: "{{ wapy_platform_dependencies[wapy_platform] }}" wapy_selinux_python_minors: + EL10: "3.12" EL9: "3.9" EL8: "3.6" - EL7: "3.6" - Fedora: "{{ (ansible_distribution_major_version == '37') | ternary('3.11', '3.10') }}" + Fedora: "{{ (ansible_distribution_major_version == '41') | ternary('3.13', '3.12') }}" Ubuntu: "" wapy_selinux_python_minor: "{{ wapy_selinux_python_minors[wapy_platform] }}" +wapy_ubuntu_newest_minors: + noble: "3.12" + jammy: "3.10" + focal: "3.8" wapy_system_newest_minors: + EL10: "3.12" EL9: "3.9" EL8: "3.6" - EL7: "3.6" - Fedora: "{{ (ansible_distribution_major_version == '37') | ternary('3.11', '3.10') }}" - Ubuntu: "{{ (ansible_distribution_major_version == 'jammy') | ternary('3.10', '3.8') }}" + Fedora: "{{ (ansible_distribution_major_version == '41') | ternary('3.13', '3.12') }}" + Ubuntu: "{{ wapy_ubuntu_newest_minors[ansible_distribution_major_version] }}" wapy_system_newest_minor: "{{ wapy_system_newest_minors[wapy_platform] }}"