title: How to use command stdin in Ansible?
body: <p>I've tried <a href="https://docs.ansible.com/ansible/2.7/modules/command_module.html" rel="noreferrer">this</a>:</p>
  
  <pre><code>- name: Log into Docker registry
    command: docker login --username "{{ docker_registry_username }}" --password-stdin
    stdin: "{{ docker_registry_password }}"
  </code></pre>
  
  <p>This results in a warning and a failing command:</p>
  
  <blockquote>
    <p>[WARNING]: Ignoring invalid attribute: stdin</p>
  </blockquote>
  
  <p>…</p>
  
  <blockquote>
    <p>Cannot perform an interactive login from a non TTY device</p>
  </blockquote>
  
  <p>I've also tried <a href="https://github.com/ansible/ansible/pull/27335#issuecomment-322643039" rel="noreferrer">this</a>:</p>
  
  <pre><code>- name: Log into Docker registry
    command: docker login --username "{{ docker_registry_username }}" --password-stdin
      stdin: "{{ docker_registry_password }}"
  </code></pre>
  
  <p>This results in a syntax error:</p>
  
  <blockquote>
    <p>ERROR! Syntax Error while loading YAML.</p>
  </blockquote>
  
  <p>Does <code>command</code> <code>stdin</code> actually work in Ansible 2.7? If so, how am I supposed to use it?</p>