Files
Kamino/extensions/molecule/image-smoke/verify.yml
T
Defame1297 62ffae7764
Build / build (pull_request) Successful in 30s
Molecule / molecule (pull_request) Failing after 1m20s
Lint / lint (pull_request) Failing after 1m50s
test(images): check become in the image-smoke scenarios
Both smoke scenarios now run a become task, as every role scenario does,
so a molecule image where become fails no longer passes its own pin pull
request. The 26.04 scenario also carries temporary diagnostics for #376.

Assisted-by: Claude Code
2026-11-25 21:28:25 +00:00

71 lines
2.1 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
- gnupg
- name: Query the units a role scenario relies on
ansible.builtin.systemd:
name: "{{ item }}"
register: kamino_smoke_units
loop:
- dbus
- ssh
- name: The dbus unit 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
- name: Run a task with become, as the role scenarios do
ansible.builtin.command: id -u
become: true
changed_when: false
register: kamino_smoke_become
- name: Become reaches root
ansible.builtin.assert:
that: kamino_smoke_become.stdout == '0'
quiet: true