strategy:
matrix:
distro:
- - ubuntu2004
- ubuntu2204
+ - ubuntu2404
fail-fast: false
steps:
- name: Gerrit Checkout
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() }}
--- /dev/null
+[defaults]
+roles_path = ./
+deprecation_warnings = False
+inject_facts_as_vars = False
+
+[privilege_escalation]
+become = True
---
- name: Converge
hosts: all
+ gather_facts: true
roles:
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
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
- 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
--- /dev/null
+ansible>=2.10
+ansible-lint>=6.0.0
+molecule>=6.0.0
+molecule-plugins[podman]>=23.0.0
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', '>=')
---
-- 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
---
-- 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'