--- - name: 🗑️ Stop and remove runner container for instance {{ runner_instance }} ansible.builtin.command: "container rm -f runner-{{ runner_instance }}" changed_when: true failed_when: false - name: 🔍 Gather containers for runner instance {{ runner_instance }} community.docker.docker_host_info: # nocheck: docker-module-uses-container-cli read-only info module; returns structured container facts the wrapper's raw JSON would need parsed containers: true containers_filters: label: - "com.docker.compose.project={{ RUNNER_PROJECT_PREFIX }}-{{ runner_instance }}" register: _runner_container_info changed_when: false failed_when: false - name: 🗑️ Remove containers for runner instance {{ runner_instance }} ansible.builtin.command: "container rm -f {{ (item.Names | default([item.Name]))[0] | regex_replace('^/', '') }}" loop: "{{ _runner_container_info.containers | default([]) }}" loop_control: label: "{{ (item.Names | default([item.Name]))[0] }}" changed_when: true failed_when: false - name: 📂 Remove runner instance directory {{ runner_instance }} file: path: "{{ RUNNER_INSTALL_DIR }}/{{ runner_instance }}" state: absent - name: 🚿 Unmount tmpfs from Docker volume dir for runner {{ runner_instance }} ansible.builtin.mount: path: "{{ RUNNER_DOCKER_BASE }}/{{ runner_instance }}" state: unmounted failed_when: false changed_when: false - name: 🗑️ Remove Docker volume directory for runner instance {{ runner_instance }} ansible.builtin.file: path: "{{ RUNNER_DOCKER_BASE }}/{{ runner_instance }}" state: absent