title: ansible write variable to local file
body: <p>I have the following ansible playbook that writes the content of the variable "hello" as a message (I got this code from an example online). I tried modifying it so it would write this to a local file however I got an error. The modified code and error message are below:</p>
  
  <p>original code (successful):</p>
  
  <pre><code>- hosts: all
    vars:
      hello: world
    tasks:
    - name: Ansible Basic Variable Example
      debug:
        msg: "{{ hello }}"
  </code></pre>
  
  <p>modified code (unsuccessful):</p>
  
  <pre><code>- hosts: all
    vars:
      hello: world
    tasks:
    - name: Ansible Basic Variable Example
    - local_action: copy content={{hello}} dest=~/ansible_logfile
      debug:
        msg: "{{ hello }}"
  </code></pre>
  
  <p>error message:</p>
  
  <pre><code>ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
  
  The error appears to have been in '/space/mathewLewis/towerCodeDeploy/playBooks/test.yml': line 5, column 5, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
    tasks:
        - name: Ansible Basic Variable Example
      ^ here
  </code></pre>
  
  <p>I would like to know how to write a variable to a file correctly</p>