title: Displaying output of a remote command with Ansible
body: <p>In an Ansible role I generate the user's SSH key. After that I want to print it to the screen and pause so the user can copy and paste it somewhere else. So far I have something like this:</p>
  
  <pre><code>- name: Generate SSH keys for vagrant user
    user: name=vagrant generate_ssh_key=yes ssh_key_bits=2048
  - name: Show SSH public key
    command: /bin/cat $home_directory/.ssh/id_rsa.pub
  - name: Wait for user to copy SSH public key
    pause: prompt="Please add the SSH public key above to your GitHub account"
  </code></pre>
  
  <p>The 'Show SSH public key' task completes but doesn't show the output.</p>
  
  <pre><code>TASK: [Show SSH public key] *************************************************** 
  changed: [default]
  </code></pre>
  
  <p>There may be a better way of going about this. I don't really like the fact that it will always show a 'changed' status. I did find this pull request for ansible - <a href="https://github.com/ansible/ansible/pull/2673" rel="noreferrer">https://github.com/ansible/ansible/pull/2673</a> - but not sure if I can use it without writing my own module.</p>