You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
886 B
YAML

---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
vars:
# exp_vals is dict where each top-level field corresponds to the name of the
# of the platforms defined in molecule.yml. The key-value pairs under the
# top-level will be used to test against the values in os_release.
exp_vals:
ubuntu:
ID: ubuntu
ID_LIKE: debian
VERSION_ID: '19.04'
centos-8-stream:
ID: centos
ID_LIKE: rhel fedora
VERSION_ID: '8'
roles:
- shnee.os_release
tasks:
- name: Is the OS in exp_vals?
ansible.builtin.assert:
that: exp_vals[ansible_hostname] is defined
- name: Verify that os-release matches our expected values.
ansible.builtin.assert:
that: os_release[item.key] == item.value
loop: "{{ exp_vals[ansible_hostname] | dict2items }}"