Extracted from the environment repository, wave 1. Scrubbed of private references: namespace mortis, no repository paths or issue numbers in comments and docs, the removed docker_ufw_rules guard dropped, the molecule scenario uses the FQCN and no provisioner environment overrides. ansible-lint mocks the role's FQCN because CI checks the Collection out outside an ansible_collections path. Verified: the commit hooks. Not verified: the molecule scenario (CI only). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
62 lines
2.3 KiB
YAML
62 lines
2.3 KiB
YAML
---
|
|
# The role runs unchanged against a signed local repository of stand-in packages (see
|
|
# prepare.yml), so the key fetch, the source line, the package install, the unit, the group
|
|
# membership and the handler are the real tasks. Only the packages are stand-ins: no Docker
|
|
# Engine is installed, and nothing here shows that dockerd works.
|
|
- name: Converge the role against the stand-in repository
|
|
hosts: all
|
|
vars:
|
|
docker_gpg_url: file:///srv/docker-stub-repo/docker.asc
|
|
docker_repo_base_url: file:///srv/docker-stub-repo
|
|
docker_users: [moleculeuser]
|
|
roles:
|
|
- role: mortis.kamino.docker
|
|
|
|
# The plays below are refusals: argument_specs rejects the wrong types before any task runs,
|
|
# so the idempotence run stays clean. A sentinel in the failure message tells "the role
|
|
# refused" from "the fail task after the role ran", which a bare rescue cannot.
|
|
- name: A docker_users value that is not a list is refused
|
|
hosts: all
|
|
gather_facts: false
|
|
vars:
|
|
docker_users:
|
|
not: a-list
|
|
tasks:
|
|
- name: Apply the role with a mapping for docker_users
|
|
block:
|
|
- name: Include the role
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.docker
|
|
- name: Fail when the wrong type was accepted
|
|
ansible.builtin.fail:
|
|
msg: MOLECULE-ACCEPTED
|
|
rescue:
|
|
- name: The argument check stopped the play
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
|
- "'docker_users' in ansible_failed_result.msg | default('')"
|
|
quiet: true
|
|
|
|
- name: A docker_remove value that is not a boolean is refused
|
|
hosts: all
|
|
gather_facts: false
|
|
vars:
|
|
docker_remove: maybe
|
|
tasks:
|
|
- name: Apply the role with a non-boolean docker_remove
|
|
block:
|
|
- name: Include the role
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.docker
|
|
- name: Fail when the wrong type was accepted
|
|
ansible.builtin.fail:
|
|
msg: MOLECULE-ACCEPTED
|
|
rescue:
|
|
- name: The argument check stopped the play
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "'MOLECULE-ACCEPTED' not in ansible_failed_result.msg | default('')"
|
|
- "'docker_remove' in ansible_failed_result.msg | default('')"
|
|
quiet: true
|