What is the username you are trying to connect as ? 

On Friday, September 28, 2018 at 10:06:32 PM UTC+5:30, Nicola Apicella 
wrote:
>
> Hi, 
>
> I am sorry for the newbie question, I ve just started looking into Ansible 
> but I did not find any info in the docs or anywhere else that could help me 
> find a resolution.
> I have a bunch of hosts on which I have sudo access.  
> *>sudo whoami*
> *root*
>
> But I do not have permission to run
> *> sudo /bin/sh -c echo "Hello!"*
> *Sorry, user some-user is not allowed to execute '/bin/sh -c echo Hello 
> world' as root on blabahost.*
>
> This is blocking me from executing a simple playbook which copies files 
> under */etc/yum.repos.d*
> The playbook like this:
>
> *---*
> *- name: test-pl*
> *  hosts: blablahost*
>
> *  tasks:*
> *  - name: test*
> *    become: yes*
> *    become_method: sudo*
> *    copy:*
> *      content: ""*
> *      dest: /etc/yum.repos.d/a*
> *      force: no*
> *      group: root*
> *      owner: root*
> *      mode: 0555*
>
> The error I get is basically the same one mentioned above. My user is not 
> allowed to execute */bin/sh *as root.
>
> blablahost | FAILED! => {
>     "changed": false, 
>     "module_stderr": "Shared connection to blablahost closed.\r\n", 
>     "module_stdout": "\r\nSorry, user some-user is not allowed to execute 
> '/bin/sh -c echo BECOME-SUCCESS-rhzefxcamynrooqcpyqppdiqvzlqbmyt; 
> /usr/bin/python 
> /home/some-user/.ansible/tmp/ansible-tmp-1538151353.33-57836367165837/command.py'
>  
> as root on blablahost.\r\n", 
>     "msg": "MODULE FAILURE", 
>     "rc": 1
> }
>
> The problem could be fixed if Ansible would allow to start the bash as a 
> normal user and then run the copy command with *sudo.*
> Basically, avoiding executing */bin/sh *as root.
> Are you aware of a workaround for this case? Or am I missing something?
>
>
> Thanks in advance.
> -Nicola
>
>
>
>
>
>

-- 
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/b5ae40b1-bb0e-466a-a979-d3e21258f806%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to