You probably need to set sudo options to not require a tty, e.g.

Defaults:selvam

On Monday, 21 March 2016 13:24:31 UTC, selvam vasu wrote:
>
> Hi,
> I am newbie to ansible. You can find it easily through this dump question. 
> I have limited access to one user(selvam) which can ran limited commands 
> using sudo option.
> My sudoers file looks like below.
>  
> selvam  ALL=(ALL) NOPASSWD: /usr/sbin/service,/usr/bin/apt-get
>
> I have tried to install apt package in remote machine using ansible 
> playbooks as selvam user with sudo option.
>
> Here is playbook file contents.
>
> playbook.yml
> ---
> - hosts: host1
>   remote_user: selvam
>   tasks:
>     - name: users package
>       apt: name={{ item }} state=latest
>       become: yes
>       with_items:
>         - nginx
>
> But the problem is when i run this playbook, I am getting the error as 
> "Missing become password". I need to install the package with passwordless.
>
> When run this below command manually from my ansible host, it is working 
> fine with passwordless. How can i accomplish the same through ansible 
> playbook.
>
> [selvam@host1] $ ssh host1 sudo -u root apt-get install nginx
>
> Ansible version:
> *******************
>
> $ ansible-playbook --version
> ansible-playbook 1.9.4
>   configured module search path = None
>
> Let me know where I have to  modify my configs. 
>
> Thanks in Advance.
>

-- 
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/e194a4e7-bc3a-4ebc-b072-36a478107b09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to