On Saturday, 14 April 2018 10.01.38 CEST Agoston Bejo wrote:
> Version a)
> 
> - name: create the file as root
>   shell: 'echo "Test_string" > /root/test.txt'
>   remote_user: root
>  
> - name: replace '_' with '-' in the file
>   replace: 
>     path: "/root/test.txt"
>     regexp: '_'
>     replace: '-'
>     backup: no
>     
> ==> it fails, because the replace task doesn't accept either remote_user or 
> sudo_user as a parameter, so it can only be run as the user running the 
> playbook, and that user can't modify a file created by root

remote_user and become_user(sudo_user is depricated) is a directive for the 
task, not the module so you indentation is probably wrong.
They must be on the same level as replace.


-- 
Kai Stian Olstad

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7076370.EtjyZMdVMF%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to