.gitea/workflows/molecule.yml runs every molecule scenario of the Collection on the kamino-molecule host-executor label of kamino-runner (the Docker daemon of the runner LXC, no job container, no Docker socket handed out), against the molecule-ubuntu2404 image pinned by tag and digest. Scenarios are discovered: extensions/molecule/*/ and roles/*/molecule/*/, so the wave-1 roles only add their scenario directory. extensions/molecule/image-smoke tests the image itself: Ubuntu 24.04, systemd as PID 1 and reachable over the container connection, the packages the roles manage, ssh enabled, the python bindings Ansible needs, NET_ADMIN. A rebuilt or re-pinned image therefore has to pass before a role scenario trusts it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
---
|
|
- name: Verify the molecule image contract
|
|
hosts: all
|
|
gather_facts: true
|
|
tasks:
|
|
- name: The instance is Ubuntu 24.04 with systemd as the service manager
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_facts['distribution'] == 'Ubuntu'
|
|
- ansible_facts['distribution_version'] == '24.04'
|
|
- ansible_facts['service_mgr'] == 'systemd'
|
|
quiet: true
|
|
|
|
- name: Gather package facts
|
|
ansible.builtin.package_facts:
|
|
manager: auto
|
|
|
|
- name: The packages the roles manage are preinstalled
|
|
ansible.builtin.assert:
|
|
that: item in ansible_facts['packages']
|
|
quiet: true
|
|
loop:
|
|
- systemd
|
|
- systemd-sysv
|
|
- dbus
|
|
- sudo
|
|
- iproute2
|
|
- ca-certificates
|
|
- python3
|
|
- python3-apt
|
|
- python3-systemd
|
|
- iptables
|
|
- ufw
|
|
- fail2ban
|
|
- openssh-server
|
|
|
|
- name: Query the units a role scenario relies on
|
|
ansible.builtin.systemd:
|
|
name: "{{ item }}"
|
|
register: kamino_smoke_units
|
|
loop:
|
|
- dbus
|
|
- ssh
|
|
|
|
- name: dbus is running and ssh is enabled
|
|
ansible.builtin.assert:
|
|
that:
|
|
- (kamino_smoke_units.results | selectattr('item', 'equalto', 'dbus') | first).status.ActiveState == 'active'
|
|
- (kamino_smoke_units.results | selectattr('item', 'equalto', 'ssh') | first).status.UnitFileState == 'enabled'
|
|
quiet: true
|
|
|
|
- name: The Python bindings Ansible's apt and systemd support need import
|
|
ansible.builtin.command: /usr/bin/python3 -c 'import apt, systemd.journal'
|
|
changed_when: false
|
|
|
|
- name: NET_ADMIN is granted, so the firewall tools can work
|
|
ansible.builtin.command: iptables -S
|
|
changed_when: false
|