From a6e8555e13e2ce1158af333f407b8b4514544e46 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Tue, 8 Sep 2026 10:14:20 +0200 Subject: [PATCH] refactor(molecule): use docker instead of podman The scenario now starts its containers with community.docker instead of containers.podman, because docker is the container runtime available on the CI runner. The connection plugin, the login command and the declared collections were adjusted accordingly and the docker SDK for python is installed in the workflow, since the module requires it. Co-authored-by: Copilot --- .gitea/workflows/molecule.yaml | 2 +- README.md | 6 +++--- molecule/default/collections.yml | 2 +- molecule/default/create.yml | 4 ++-- molecule/default/destroy.yml | 2 +- molecule/default/molecule.yml | 2 +- molecule/default/prepare.yml | 2 +- requirements.yaml | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/molecule.yaml b/.gitea/workflows/molecule.yaml index 15e6832..859079c 100644 --- a/.gitea/workflows/molecule.yaml +++ b/.gitea/workflows/molecule.yaml @@ -24,7 +24,7 @@ jobs: run: | apt update --yes apt install --yes python3-pip - pip3 install --break-system-packages molecule + pip3 install --break-system-packages molecule docker - name: Run molecule run: molecule test working-directory: certificate_authority diff --git a/README.md b/README.md index d6a2372..514114c 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,16 @@ certificate_authority_client_subject_alternative_names: ## Tests -The role is tested with [Molecule](https://ansible.readthedocs.io/projects/molecule/). The scenario starts one podman +The role is tested with [Molecule](https://ansible.readthedocs.io/projects/molecule/). The scenario starts one docker container per supported distribution family, applies the role, asserts that a second run reports no change and finally verifies the issued certificates with `openssl verify`, their file permissions and the anchor in the systems trust store. -Molecule ships only its `default` driver, therefore `podman` is required besides molecule itself. The collections are +Molecule ships only its `default` driver, therefore `docker` is required besides molecule itself. The collections are declared in `molecule/default/collections.yml` and installed by molecule. ```bash -pip install molecule +pip install molecule docker ``` The complete sequence creates the containers, tests them and removes them afterwards. diff --git a/molecule/default/collections.yml b/molecule/default/collections.yml index 74ba4b1..a868d81 100644 --- a/molecule/default/collections.yml +++ b/molecule/default/collections.yml @@ -2,4 +2,4 @@ collections: - name: community.crypto -- name: containers.podman +- name: community.docker diff --git a/molecule/default/create.yml b/molecule/default/create.yml index 60a8e84..b7b5e8c 100644 --- a/molecule/default/create.yml +++ b/molecule/default/create.yml @@ -5,7 +5,7 @@ gather_facts: false tasks: - name: Start a container per platform - containers.podman.podman_container: + community.docker.docker_container: name: "{{ item.name }}" image: "{{ item.image }}" command: "sleep infinity" @@ -19,7 +19,7 @@ content: | {% for platform in molecule_yml.platforms %} - instance: {{ platform.name }} - connection: containers.podman.podman + connection: community.docker.docker {% endfor %} dest: "{{ molecule_instance_config }}" mode: "0600" diff --git a/molecule/default/destroy.yml b/molecule/default/destroy.yml index 8149947..fc178d7 100644 --- a/molecule/default/destroy.yml +++ b/molecule/default/destroy.yml @@ -5,7 +5,7 @@ gather_facts: false tasks: - name: Remove the container of every platform - containers.podman.podman_container: + community.docker.docker_container: name: "{{ item.name }}" state: absent loop: "{{ molecule_yml.platforms }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index cd79f04..0f24d32 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -4,7 +4,7 @@ driver: name: default options: managed: true - login_cmd_template: "podman exec --interactive --tty {instance} bash" + login_cmd_template: "docker exec --interactive --tty {instance} bash" platforms: - name: certificate-authority-archlinux diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index a3ddda3..95178fa 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -16,7 +16,7 @@ dnf install --assumeyes ca-certificates gawk openssl python3 fi tasks: - # The podman connection plugin splits raw commands instead of passing them to a shell. + # The raw command is wrapped explicitly, because the bootstrap relies on shell builtins. - name: Bootstrap the python interpreter and the tools required by the role ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}" changed_when: true diff --git a/requirements.yaml b/requirements.yaml index 74ba4b1..a868d81 100644 --- a/requirements.yaml +++ b/requirements.yaml @@ -2,4 +2,4 @@ collections: - name: community.crypto -- name: containers.podman +- name: community.docker