From 379bb5f8abf2fbeb6a33768f4ab185c0938958b2 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Fri, 12 Dec 2025 23:07:23 +1000 Subject: [PATCH] Fix: Update to Ubuntu24.04, CS9, and Podman driver - Switch from Docker to Podman driver for Molecule tests - Add Ubuntu 24.04, CentOS Stream 9 support - Remove EOL distributions (CentOS 7/8, Ubuntu 18.04/20.04) - Add CentOS Stream 9 and RedHat 9 var files with native parallel package - Fix Node.js repo installation for CentOS 7/8 only (not EL9) - Update workflow to use requirements.txt and Python 3.11 - Add ansible.cfg to disable inject_facts_as_vars deprecation - Set MOLECULE_PROJECT_DIRECTORY for dynamic role lookup - Add gather_facts: true to converge.yml CentOS 9 changes: - Use native 'parallel' package instead of CERN RPM - Restrict Nodesource Node.js repo to EL7/8 only - Add separate vars files for CentOS Stream 9 and RedHat 9 Change-Id: I82a9520b86c357686ebd6b53686081ec04d2b7eb Signed-off-by: Anil Belur --- .ansible.cfg | 3 +++ .github/workflows/gerrit-verify.yaml | 18 ++++++++++++------ molecule/default/converge.yml | 1 + molecule/default/molecule.yml | 29 +++++++++++++++++------------ requirements.txt | 4 ++++ tasks/main.yml | 6 ++++-- vars/CentOS Stream-9.yaml | 13 +++++++++++++ vars/RedHat-9.yaml | 12 ++++++++++++ vars/RedHat.yaml | 2 +- 9 files changed, 67 insertions(+), 21 deletions(-) create mode 100644 .ansible.cfg create mode 100644 requirements.txt create mode 100644 vars/CentOS Stream-9.yaml create mode 100644 vars/RedHat-9.yaml diff --git a/.ansible.cfg b/.ansible.cfg new file mode 100644 index 0000000..0aa5b5b --- /dev/null +++ b/.ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +roles_path = ./ +inject_facts_as_vars = False diff --git a/.github/workflows/gerrit-verify.yaml b/.github/workflows/gerrit-verify.yaml index 040838b..554ba56 100644 --- a/.github/workflows/gerrit-verify.yaml +++ b/.github/workflows/gerrit-verify.yaml @@ -111,8 +111,9 @@ jobs: strategy: matrix: distro: - - ubuntu2004 + - centos9 - ubuntu2204 + - ubuntu2404 fail-fast: false steps: - name: Gerrit Checkout @@ -123,17 +124,22 @@ jobs: gerrit-project: ${{ inputs.GERRIT_PROJECT }} gerrit-url: ${{ vars.GERRIT_URL }} delay: "0s" - - name: Install test dependencies. + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install test dependencies run: | python -m pip install --upgrade pip - pip3 install ansible ansible-lint molecule-plugins[docker] docker - - name: Run Molecule tests. - run: molecule test - working-directory: ${{env.working-directory}} + pip3 install -r requirements.txt + - name: Run Molecule tests + run: | + cat molecule/default/molecule.yml + molecule test env: PY_COLORS: "1" ANSIBLE_FORCE_COLOR: "1" MOLECULE_PLATFORM_NAME: ${{ matrix.distro }} + MOLECULE_PROJECT_DIRECTORY: ${{ github.workspace }} vote: if: ${{ always() }} diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 1e30adc..a8044fd 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -1,5 +1,6 @@ --- - name: Converge hosts: all + gather_facts: true roles: - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0353568..c519370 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -2,22 +2,27 @@ dependency: name: galaxy driver: - name: docker + name: podman platforms: - # - name: centos7 - # image: centos:7 - # - name: centos8 - # image: quay.io/centos/centos:stream8 - # - name: ubuntu1804 - # image: ubuntu:18.04 - - name: ubuntu2004 - image: ubuntu:20.04 + - name: centos9 + image: quay.io/centos/centos:stream9 - name: ubuntu2204 image: ubuntu:22.04 - name: ubuntu2404 image: ubuntu:24.04 provisioner: name: ansible - # Fix for role path finding in latest molecule versions (~25.4.0) - env: - ANSIBLE_ROLES_PATH: ../../../ + config_options: + defaults: + callbacks_enabled: ansible.posix.profile_tasks + inject_facts_as_vars: false + inventory: + host_vars: + centos9: + ansible_python_interpreter: /usr/bin/python3 + ubuntu2204: + ansible_python_interpreter: /usr/bin/python3 + ubuntu2404: + ansible_python_interpreter: /usr/bin/python3 +verifier: + name: ansible diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..51293df --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +ansible>=2.17,<2.19 +ansible-lint>=6.22,<25.0 +molecule>=6.0,<25.0 +molecule-plugins[podman]>=23.5,<25.0 diff --git a/tasks/main.yml b/tasks/main.yml index 27238ad..7ae0f1f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -94,7 +94,7 @@ https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL state: present - - name: Add Nodesource repositories for Node.js (CentOS 7+). + - name: Add Nodesource repositories for Node.js (CentOS 7/8 only). ansible.builtin.yum: name: "https://rpm.nodesource.com/{{ nodejs_rhel_rpm_dir }}/el/\ @@ -102,7 +102,9 @@ {{ ansible_architecture }}/nodesource-release-el\ {{ ansible_distribution_major_version }}-1.noarch.rpm" state: present - when: ansible_distribution_major_version | int >= 7 + when: + - ansible_distribution_major_version | int >= 7 + - ansible_distribution_major_version | int <= 8 register: node_repo - name: Update package cache if repo was added. diff --git a/vars/CentOS Stream-9.yaml b/vars/CentOS Stream-9.yaml new file mode 100644 index 0000000..c1dc2d9 --- /dev/null +++ b/vars/CentOS Stream-9.yaml @@ -0,0 +1,13 @@ +--- +# CentOS Stream 9 specific recommended tools (exclude legacy CentOS7 RPM URLs) +lf_recommended_tools_packages_distro: + - bzip2 + - fedora-packager + - findutils + - parallel + - nc + - perl-Digest-SHA + - perl-ExtUtils-MakeMaker + - perl-XML-XPath + - sqlite + - xz diff --git a/vars/RedHat-9.yaml b/vars/RedHat-9.yaml new file mode 100644 index 0000000..4acbb30 --- /dev/null +++ b/vars/RedHat-9.yaml @@ -0,0 +1,12 @@ +--- +lf_recommended_tools_packages_distro: + - bzip2 + - fedora-packager + - findutils + - parallel + - nc + - perl-Digest-SHA + - perl-ExtUtils-MakeMaker + - perl-XML-XPath + - sqlite + - xz diff --git a/vars/RedHat.yaml b/vars/RedHat.yaml index 5a5c5cf..4acbb30 100644 --- a/vars/RedHat.yaml +++ b/vars/RedHat.yaml @@ -3,7 +3,7 @@ lf_recommended_tools_packages_distro: - bzip2 - fedora-packager - findutils - - https://linuxsoft.cern.ch/cern/centos/7/cern/x86_64/Packages/parallel-20150522-1.el7.cern.noarch.rpm + - parallel - nc - perl-Digest-SHA - perl-ExtUtils-MakeMaker -- 2.16.6