# 'Interactive authentication required' error even using 'become'

**URL:** <https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [October 30, 2017, 11:07am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863 "2017-10-30T11:07:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dev](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dev](https://forum.ansible.com/u/Dev)\
**Post date:** [October 30, 2017, 11:07am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/1 "2017-10-30T11:07:48Z")

</div>

Hello everyone,

I’m using the following construction to start and stop wildfly service:

`

- hosts: appserver  
remote\_user: jenkins  
tasks:

- name: Stop WildFly  
become: true  
become\_user: wildfly  
become\_method: sudo  
systemd:  
name: wildfly  
state: stopped

- name: Start WildFly  
become: true  
become\_user: wildfly  
become\_method: sudo  
systemd:  
name: wildfly  
state: started

`

But in every time and after many combinations I’m still geting an error message:

Unable to stop service wildfly: Failed to stop wildfly.service: Interactive authentication required.

Similar construction (without systemcmd module) works fine:

`

- name: Stop WildFly  
command: sudo systemctl stop wildfly  
become: true  
become\_user: wildfly

`

And I don’t have any problems to switch to user wildfly using sudo, in the unix command line.

Do you have any ideas what could be wrong?

Ansible version: 2.3.2.0  
Python version: 2.7.5  
OS: RHEL 7.4

---

<div class="post-metadata">

**Author:** ![Karn\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@Karn\_Kumar](https://forum.ansible.com/u/Karn_Kumar)\
**Post date:** [October 30, 2017, 2:54pm UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/2 "2017-10-30T14:54:08Z")

</div>

What if you use `service module just the sake for rather systemd… pls try below and see how it goes  
it looks like a bug with systemd …

`

- name: start WildFly service  
service:  
name: WildFly  
state: started  
enabled: True  
`

---

<div class="post-metadata">

**Author:** ![Dev](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dev](https://forum.ansible.com/u/Dev)\
**Post date:** [October 31, 2017, 6:33am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/3 "2017-10-31T06:33:08Z")

</div>

Still I got an error message:

fatal: [[mydomain.com](http://mydomain.com)]: FAILED! =\> {  
“changed”: false,  
“failed”: true,  
“invocation”: {  
“module\_args”: {  
“daemon\_reload”: false,  
“enabled”: true,  
“masked”: null,  
“name”: “wildfly”,  
“no\_block”: false,  
“state”: “stopped”,  
“user”: false  
}  
},  
“msg”: “Unable to enable service wildfly: Failed to execute operation: Interactive authentication required.\n”  
}

W dniu poniedziałek, 30 października 2017 15:54:09 UTC+1 użytkownik Karn Kumar napisał:

---

<div class="post-metadata">

**Author:** ![Dev](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dev](https://forum.ansible.com/u/Dev)\
**Post date:** [November 9, 2017, 8:05am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/4 "2017-11-09T08:05:43Z")

</div>

I also tried to use **become** inside **hosts** section, but it also doesn’t help.

`

- hosts: appserver  
remote\_user: jenkins  
become: yes  
become\_user: wildfly  
become\_method: sudo  
tasks:

- name: Stop WildFly  
become: true  
become\_user: root  
become\_method: sudo  
systemd:  
name: wildfly  
state: stopped

`

But in this case the following message appears:  
sudo: a password is required

W dniu poniedziałek, 30 października 2017 12:07:48 UTC+1 użytkownik Dev napisał:

---

<div class="post-metadata">

**Author:** ![PhilEv](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@PhilEv](https://forum.ansible.com/u/PhilEv)\
**Post date:** [November 9, 2017, 10:16am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/5 "2017-11-09T10:16:37Z")

</div>

I do not think it is a systemd bug.

related to your first palybook in this mail-threadthe jenkins user or any other you use to connect to the system via ssh must have sudo capability (e.g: be in the wheel group)  
and you need to pass the passwork with -K (or its moder equivalent)

---

<div class="post-metadata">

**Author:** ![Andrew\_thomas](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Andrew\_thomas](https://forum.ansible.com/u/Andrew_thomas)\
**Post date:** [January 21, 2018, 4:37am UTC](https://forum.ansible.com/t/interactive-authentication-required-error-even-using-become/25863/6 "2018-01-21T04:37:49Z")

</div>

Me too facing the same issue, privilege escalation is not working as expected. However, like you mentioned it works perfectly fine while using command/shell module. Please guide me if you got any solution.
