title: Killing a task in Ansible
body: <p>What is the best way to kill a task with ansible? I have kafka running as regular executable, not as a service. When I send a kill to it, it takes a while to wrap things up and close down. I would like ansible to wait around before moving on after it sends the kill command to make sure that the service is actually stopped. </p>
  
  <p>So far this is what I have, I am not sure how to do this reliably. </p>
  
  <pre><code>---
  - name: Stopping Kafka
    command: "bin/kafka-server-stop.sh config/server.properties"
    args:
      chdir: "{{base_apps}}/kafka/kafka_2.11-0.9.0.1" 
    ignore_errors: yes
  </code></pre>
  
  <p>Thanks</p>