title: using register in ansible task
body: <p>I am trying to find a particular line in the <code>cat /etc/fstab</code>, register it in a variable and then want to use it to <code>umount</code> the found directory.</p>
  
  <pre><code>---
  - hosts: all
    remote_user: root
  
    tasks:
    - name: Finding if the mount point exists
      shell: cat /etc/fstab | grep /mnt | awk '{print $2}'
      register: mountpoint
  
    - name: UMOUNT the mountpoint found in expression
      shell: umount "{{ item }}"
      with_items: mountpoint.stdout
  </code></pre>
  
  <p>I see the output works for first task. However in the second task it says, <code>"stderr": "umount: mountpoint.stdout: mountpoint not found", "stderr_lines": ["umount: mountpoint.stdout: mountpoint not found"]"</code></p>
  
  <p>Isn't it the register variable should work here? am i missing something?</p>
  
  <p><strong>This is the output</strong> </p>
  
  <pre><code>{
      "_ansible_parsed": true,
      "stderr_lines": [],
      "cmd": "cat /etc/fstab | grep /mnt | awk '{print $2}'",
      "end": "2017-09-29 15:07:12.717112",
      "_ansible_no_log": false,
      "stdout": "/mnt/dvd",
      "changed": true,
  </code></pre>
  
  <p><code>stdout</code> is found here as /mnt/dvd. now  would like to <code>umount</code> it.</p>
  
  <p>Thank you in advance.</p>