Hi,
  I'm connecting to my host as "user1" and my become user name is "user2". 
The only account that has sudo privs to run the "do-something" command is 
*user1*.

*Attempt 1:*
  I'm trying to run the following task, but it doesn't work because ansible 
isn't providing the password to the host and it sits there until it times 
out:

task:

- name: apply configurator on {{ inventory_hostname }}

 become: false
>
 shell: "sudo /usr/bin/do-something"
>

output:

<times-out> 


*Attempt 2:*

 I then tried to run the following task, but it doesn't work because it runs as 
*user2*, but that's not what I want because *user2* doesn't have sudo privs:


task:

- name: apply configurator on {{ inventory_hostname }}

 become: true
>
 shell: "/usr/bin/do-something"
>

output:

fatal: [host]: FAILED! => {"changed": true, "cmd": "/usr/bin/do-something", 
"delta": "0:00:00.027783", "end": "2018-03-01 21:46:58.719945", "msg": 
"non-zero return code", "rc": 126, "start": "2018-03-01 21:46:58.692162", 
"stderr": "/bin/sh: /usr/bin/do-something: Permission denied", "stderr_lines": 
["/bin/sh: /usr/bin/do-something: Permission denied"], "stdout": "", 
"stdout_lines": []} 


*Attempt 3:*

 I then try to run the following task, but it hangs as it waits for credentials 
for *user2*'s password, which ansible will not provide (even it it worked):


task:

- name: apply configurator on {{ inventory_hostname }}

 become: true
>
 shell: "sudo /usr/bin/do-something"
>

output:

<times-out> 


  I've even tried setting the become_user to *user1*, but that doesn't work 
either. Using "sudo" in the shell command causes it to hang because a prompt 
for password is waiting whereas keeping "sudo" out gets me another permission 
error.

  Any help is greatly appreciated.

Thanks,
Kevin
 

-- 
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/c5321cfa-128f-4cd8-ba3f-9e3fa9321e61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to