title: Ansible expect module not working
body: <p>This has been irritating me for the past hour, I use Ansible's expect module to answer to a command prompt, namely:</p>
  
  <pre><code>Re-format filesystem in Storage Directory /mnt/ephemeral-hdfs/dfs/name ? (Y or N)
  </code></pre>
  
  <p>for which I want to reply</p>
  
  <pre><code>Y
  </code></pre>
  
  <p>This should work according to standard regex matching and <a href="https://stackoverflow.com/questions/39161979/ansible-expect-module-cant-match-string-regex-script-questions">this other stackoverflow question</a></p>
  
  <pre><code> - name: Run Spark Cluster script
      expect:
         command: /home/ubuntu/cluster_setup/scripts/shell/utils-cluster_launcher-start_spark.sh
         responses:
            "Re-format filesystem": "Y"
         timeout: 600
         echo: yes
  </code></pre>
  
  <p>The issue I am facing is that when it reaches the point where it expects keyboard input it doesn't get anything, therefore it hangs. There is no error output as such; it just stays still.</p>
  
  <p>Any ideas how to fix this?</p>