--- - name: Ensure Docker registry container is stopped docker_container: image: "{{ item.value.image }}" name: "{{ item.value.container_name }}" state: "stopped" with_dict: "{{ docker_registry_services }}" when: - item.value.enabled | bool