'Interactive authentication required' error even using 'become'

2,987 views
Skip to first unread message

Dev

unread,
Oct 30, 2017, 7:07:48 AM10/30/17
to Ansible Project
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

Karn Kumar

unread,
Oct 30, 2017, 10:54:09 AM10/30/17
to Ansible Project
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

Dev

unread,
Oct 31, 2017, 2:33:09 AM10/31/17
to Ansible Project
Still I got an error message:

fatal: [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"
}

Dev

unread,
Nov 9, 2017, 3:05:43 AM11/9/17
to Ansible Project
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

Philippe Eveque

unread,
Nov 9, 2017, 5:16:50 AM11/9/17
to ansible...@googlegroups.com
I do not think it is a systemd bug.

related to your first palybook in this mail-thread
the 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)


--
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+unsubscribe@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/ed64ea40-5316-437c-ad7c-cb3f77c8bf4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew thomas

unread,
Jan 20, 2018, 11:37:49 PM1/20/18
to Ansible Project
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.
Reply all
Reply to author
Forward
0 new messages