--- - name: Get container facts kolla_container_facts: name: - heka register: container_facts - name: Removing heka container kolla_docker: action: "remove_container" name: "heka" when: - container_facts['heka'] is defined