Try adding 

Defaults:username !requiretty

to /etc/sudoers.

On Sunday, 20 March 2016 20:15:40 UTC, TJG wrote:
>
> Hi all;
>
> Just looking for a little help to spot what I might be missing. Against a 
> Centos 7 box, using Ansible 2.1.0, this task:
>
>  - name: restart httpd
>       service:
>         name: httpd
>         state: restarted
>
> is giving me an "Interactive authentication required." error when run 
> under Ansible 2.1.0 via:
>
> ansible-playbook -i inventory test.yml --sudo --ask-sudo-pass --ask-become
> -pass --sudo -vvvv
>
>
> My playbook is set with:
>
>   # The user that logs into the machine
>   remote_user: apps
>
>   # Indicates that we also want to be become the user we log in as, for 
> running tasks
>   # (otherwise the user defaults to root)
>   become: yes
>   become_user: apps
>
>
> and on the Centos 7 box, my "apps" user is in the "wheel" group, and the 
> wheel group is covered with sudoer permissions as follows:
>
> ## Allows people in group wheel to run all commands
> %wheel  ALL=(ALL)       ALL
>
> ## Same thing without a password
> %wheel  ALL=(ALL)       NOPASSWD: ALL
>
>
> I understood that with my playbook set to use "become", and "become_user", 
> that this task would run as sudo? 
>
> So, why the "Interactive authentication required" error? 
>
> Of course, I can resort to:
>
>     - name: Restart apache
>       shell: sudo systemctl restart httpd
>
>
> which doesn't prompt me, but I'd like to understand why the advocated 
> method isn't observing that I'm running under sudo? 
>
> Many thanks,
> Tim
>
>

-- 
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/bf0ea3ac-1f96-4e1c-8f93-4d0d97dd1a2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to