for a task that you don't want to run as root add:

sudo: yes
sudo_user: nonrootuser

On Mon, Sep 15, 2014 at 8:27 PM, Toshio Kuratomi <[email protected]> wrote:
> Are you setting ansible_ssh_user = root in the inventory file?  If so, then
> yep, this is how ansible is designed but it does confuse people.  There's a
> few bug reports where the concepts are explained:
>
> https://github.com/ansible/ansible/issues/4688
> https://github.com/ansible/ansible/issues/4622
>
> The bug reports also point at a workaround that might work for your use
> case:
>
> - hosts: webservers
>   vars:
>     - ansible_ssh_user: "meow"
>   roles:
>     - clone_repo
>
>   tasks:
>     - name: write_directory
>       file: path=/home/meow/dir state=directory
>
>
>
> -Toshio
>
> On Mon, Sep 15, 2014 at 4:40 PM, John Yeuk Hon Wong <[email protected]>
> wrote:
>>
>> my ansible_ssh_user is root, but I want a particular role to use a
>> particular user.
>>
>> For example, create a directory with this remote_user as owner and group.
>> I know I can set the owner-permission using file module, but I was expecting
>> the following to work
>>
>> - hosts: webservers
>>   remote_user: "meow"
>>   roles:
>>     - clone_repo
>>
>>   tasks:
>>     - name: write directory
>>       file: path=/home/meow/dir state=directory
>>
>> In addition to directory creation, clone_repo actually clone a repo. But
>> remote_user is not actually used. They are root/root.
>>
>> Did I misread the doc?
>> http://docs.ansible.com/playbooks_intro.html#hosts-and-users
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/63a47337-f61c-4db6-a129-5a6d08b68f09%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAG9juEoteu2BLNRFiCONm%2B9j7Q92i2_%2BcRrmVOXtVAXNaZyvjg%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca
Stultorum infinitus est numerus
0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001
Pedo mellon a minno

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CADn%2BHswfzZ6CAXAsCGSyqGaGyoZEmGTt85X8wYxpf_DC5sQq2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to