Fix: Update to Ubuntu 24.04 and Podman driver 83/73983/1 master
authorAnil Belur <abelur@linuxfoundation.org>
Sat, 13 Dec 2025 02:17:49 +0000 (12:17 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Sat, 13 Dec 2025 07:25:11 +0000 (17:25 +1000)
- Update molecule platforms to Ubuntu 22.04, 24.04
- Remove EOL distributions (CentOS 7, Ubuntu 18.04, 20.04)
- NOTE: CentOS Stream 9 not included - Mono project does not yet support EL9
- Switch from Docker to Podman driver
- Add ansible.cfg with role path and deprecation settings
- Add requirements.txt with Podman molecule plugin
- Update GitHub workflow to use Podman and Python 3.11
- Add MOLECULE_PROJECT_DIRECTORY and ANSIBLE_ROLES_PATH env vars
- Modernize prepare.yml with ansible.builtin FQCN
- Set inject_facts_as_vars: false to fix deprecation warning
- Update tasks to use ansible_facts dictionary
- Handle Ubuntu 24.04 nuget package unavailability
- Handle CentOS 9 mono repository limitations with warnings

Change-Id: Ie166b04101e7f7b0f4a90c358174672bca9bd7bc
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
.github/workflows/gerrit-verify.yaml
ansible.cfg [new file with mode: 0644]
molecule/default/converge.yml
molecule/default/molecule.yml
molecule/default/prepare.yml
requirements.txt [new file with mode: 0644]
tasks/Debian.yml
tasks/RedHat.yml
tasks/main.yml

index 040838b..bc6366c 100644 (file)
@@ -111,8 +111,8 @@ jobs:
     strategy:
       matrix:
         distro:
-          - ubuntu2004
           - ubuntu2204
+          - ubuntu2404
       fail-fast: false
     steps:
       - name: Gerrit Checkout
@@ -123,17 +123,20 @@ jobs:
           gerrit-project: ${{ inputs.GERRIT_PROJECT }}
           gerrit-url: ${{ vars.GERRIT_URL }}
           delay: "0s"
-      - name: Install test dependencies.
-        run: |
-          python -m pip install --upgrade pip
-          pip3 install ansible ansible-lint molecule-plugins[docker] docker
-      - name: Run Molecule tests.
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: "3.11"
+      - name: Install test dependencies
+        run: pip3 install -r requirements.txt
+      - name: Run Molecule tests
         run: molecule test
-        working-directory: ${{env.working-directory}}
         env:
           PY_COLORS: "1"
           ANSIBLE_FORCE_COLOR: "1"
           MOLECULE_PLATFORM_NAME: ${{ matrix.distro }}
+          MOLECULE_PROJECT_DIRECTORY: ${{ github.workspace }}
+          ANSIBLE_ROLES_PATH: ${{ github.workspace }}
 
   vote:
     if: ${{ always() }}
diff --git a/ansible.cfg b/ansible.cfg
new file mode 100644 (file)
index 0000000..b49fcc8
--- /dev/null
@@ -0,0 +1,7 @@
+[defaults]
+roles_path = ./
+deprecation_warnings = False
+inject_facts_as_vars = False
+
+[privilege_escalation]
+become = True
index 1e30adc..a8044fd 100644 (file)
@@ -1,5 +1,6 @@
 ---
 - name: Converge
   hosts: all
+  gather_facts: true
   roles:
     - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
index 23a56f1..4260246 100644 (file)
@@ -2,19 +2,26 @@
 dependency:
   name: galaxy
 driver:
-  name: docker
+  name: podman
 platforms:
-  - name: centos7
-    image: centos:7
-  - name: ubuntu1804
-    image: ubuntu:18.04
-  - name: ubuntu2004
-    image: ubuntu:20.04
   - name: ubuntu2204
     image: ubuntu:22.04
+    pre_build_image: false
+  - name: ubuntu2404
+    image: ubuntu:24.04
+    pre_build_image: false
 provisioner:
   name: ansible
+  config_options:
+    defaults:
+      inject_facts_as_vars: false
+  inventory:
+    host_vars:
+      ubuntu2204:
+        ansible_python_interpreter: /usr/bin/python3
+      ubuntu2404:
+        ansible_python_interpreter: /usr/bin/python3
 scenario:
   name: default
 verifier:
-  name: testinfra
+  name: ansible
index 0ae381f..719551d 100644 (file)
@@ -2,25 +2,24 @@
 - name: Prepare
   hosts: all
   gather_facts: true
-
   tasks:
     - name: Update APT cache
-      apt:
-        update_cache: yes
-      when: ansible_distribution == 'Ubuntu'
+      ansible.builtin.apt:
+        update_cache: true
+      when: ansible_facts['distribution'] == 'Ubuntu'
       become: true
 
-    - name: Install cron
-      yum:
+    - name: Install cron on RedHat
+      ansible.builtin.dnf:
         name: cronie
         state: present
-      when: ansible_os_family == 'RedHat'
+      when: ansible_facts['os_family'] == 'RedHat'
       become: true
 
-    - name: Install packages
-      package:
+    - name: Install required packages
+      ansible.builtin.package:
         name:
           - zip
           - unzip
         state: present
-      become: yes
+      become: true
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..b6bd94c
--- /dev/null
@@ -0,0 +1,4 @@
+ansible>=2.10
+ansible-lint>=6.0.0
+molecule>=6.0.0
+molecule-plugins[podman]>=23.0.0
index 439caf3..40a2781 100644 (file)
@@ -3,7 +3,17 @@
   ansible.builtin.package:
     name:
       - mono-complete
-      - nuget
+      - "{{ 'nuget' if ansible_facts.distribution_version is version('24.04', '<') else omit }}"
     state: present
     update_cache: true
   become: true
+  when: ansible_facts.distribution_version is version('24.04', '<')
+
+- name: Install mono-complete only (Ubuntu 24.04+)
+  ansible.builtin.package:
+    name:
+      - mono-complete
+    state: present
+    update_cache: true
+  become: true
+  when: ansible_facts.distribution_version is version('24.04', '>=')
index 74606c3..b3d07b4 100644 (file)
@@ -1,25 +1,47 @@
 ---
-- name: Add Mono RPM Key
+- name: Add Mono RPM Key (CentOS <= 8)
   ansible.builtin.rpm_key:
     key: http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
     state: present
   become: true
+  when: ansible_facts.distribution_major_version is version('9', '<')
+  ignore_errors: true
 
 - name: Add Mono repository
   ansible.builtin.yum_repository:
     name: mono-project
     description: Mono Project CentOS repository
-    baseurl: http://download.mono-project.com/repo/centos
+    baseurl: http://download.mono-project.com/repo/centos{{ ansible_facts.distribution_major_version }}
     enabled: true
+    gpgcheck: false
     repo_gpgcheck: false
     skip_if_unavailable: true
   become: true
 
-- name: Install mono-complete and nuget
-  ansible.builtin.yum:
+- name: Install mono-complete and nuget (CentOS <= 8)
+  ansible.builtin.dnf:
     name:
       - mono-complete
       - nuget
     state: present
     update_cache: true
   become: true
+  when: ansible_facts.distribution_major_version is version('9', '<')
+
+- name: Install mono-complete only (CentOS 9+)
+  ansible.builtin.dnf:
+    name:
+      - mono-complete
+    state: present
+    update_cache: true
+  become: true
+  when: ansible_facts.distribution_major_version is version('9', '>=')
+  ignore_errors: true
+  register: mono_install_centos9
+
+- name: Warn about Mono availability on CentOS 9+
+  ansible.builtin.debug:
+    msg: "WARNING: Mono may not be available for CentOS Stream 9. Mono project may not have official support yet."
+  when:
+    - ansible_facts.distribution_major_version is version('9', '>=')
+    - mono_install_centos9 is failed
index cfcd808..337148b 100644 (file)
@@ -1,5 +1,5 @@
 ---
-- name: Include tasks from '{{ ansible_os_family }}'
+- name: Include tasks from '{{ ansible_facts.os_family }}'
   ansible.builtin.include_tasks: '{{ item }}'
   with_first_found:
-    - '{{ ansible_os_family }}.yml'
+    - '{{ ansible_facts.os_family }}.yml'