title: Ansible run delegate_to task on remote machine as different user
body: <p>I want to set a cron entry on a remote host, but connecting to the host as a different user.</p>
  <pre><code># task
  - name: Cron to ls at a specific time
    cron:
      name: &quot;perform a listing&quot;
      weekday: &quot;6&quot;
      minute: &quot;5&quot;
      hour: &quot;3&quot;
      job: &quot;/bin/ls -lR /mnt/*/&quot;
    delegate_to: &quot;{{ my_remote_machine }}&quot;
  </code></pre>
  <p><strong>Problem</strong>
  This is a startup script on an instance in the cloud.<br />
  The script runs as root, there fore will try to connect to <code>{{ my_remote_machine }}</code> as root.<br />
  <code>root</code> is obviously disabled by default on most cloud instances.<br />
  Because of this, I can't use the <code>become_user</code> keyword.</p>
  <p>Do I have any other options?</p>