title: Ansible - Save registered variable to file
body: <p>How would I save a registered Variable to a file? I took this from the <a href="http://docs.ansible.com/playbooks_variables.html#registered-variables">tutorial</a>:</p>
  
  <pre><code>- hosts: web_servers
  
    tasks:
  
       - shell: /usr/bin/foo
         register: foo_result
         ignore_errors: True
  
       - shell: /usr/bin/bar
         when: foo_result.rc == 5
  </code></pre>
  
  <p>How would I save <code>foo_result</code> variable to a file e.g. <code>foo_result.log</code> using ansible?</p>