title: Ansible local_action example how does it work
body: <p>How does the following Ansible play work:</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Generate join command
      command: kubeadm token create --print-join-command
      register: join_command
  
    - name: Copy join command to local file
      local_action: copy content=&quot;{{ join_command.stdout_lines[0] }}&quot; dest=&quot;./join-command&quot;
  </code></pre>
  <p>So as I understand, local_action is the same as delegate_to
  but, copy content= did not make any sense. Isn't the actual command like &quot;cp&quot; need to be specified?</p>
  <p>Take this example:
  <code>local_action: command ping -c 1 {{ inventory_hostname }}</code></p>
  <p>Can we use something like this:</p>
  <p><code>local_action: command cp content=&quot;{{ join_command.stdout_lines[0] }}&quot; dest=&quot;./join-command&quot;</code></p>