30 lines
966 B
YAML
30 lines
966 B
YAML
- name: Fail if molecule group is missing
|
|
hosts: localhost
|
|
tasks:
|
|
- name: Print some info
|
|
ansible.builtin.debug:
|
|
msg: "{{ groups }}"
|
|
|
|
- name: Assert group existence
|
|
ansible.builtin.assert:
|
|
that: "'molecule' in groups"
|
|
fail_msg: |
|
|
molecule group was not found inside inventory groups: {{ groups }}
|
|
|
|
- name: Converge
|
|
hosts: molecule
|
|
# We disable gather facts because it would fail due to our container not
|
|
# having python installed. This will not prevent use from running 'raw'
|
|
# commands. Most molecule users are expected to use containers that already
|
|
# have python installed in order to avoid notable delays installing it.
|
|
gather_facts: false
|
|
tasks:
|
|
- name: Check uname (converge)
|
|
ansible.builtin.raw: uname -a
|
|
register: result
|
|
changed_when: false
|
|
|
|
- name: Print some info (converge)
|
|
ansible.builtin.assert:
|
|
that: result.stdout | regex_search("^Linux")
|