title: ansible ad-hoc command to run as other user
body: <p>In Ansible documention its stated like :-</p>
  
  <p><strong>It is also possible to become a user other than root using --become-user:
  $ ansible atlanta -a "/usr/bin/foo" -u username --become-user otheruser [--ask-become-pass]</strong></p>
  
  <p>But when i run this command </p>
  
  <pre><code>ansible webservers  -m shell -a "mkdir /tmp/devopstraining" --become-user devops
  </code></pre>
  
  <p>its creating directories with root as owner.If as per documentation if this command is running as devops user then  user devops should be the owner of the directory created.</p>
  
  <p>I am aware that i can use file module to deal with permissions but just curious to know why its not working in above command.</p>