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)
2017-11-09 9:05 GMT+01:00 Dev <[email protected]>: > 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ł: >> >> 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 >> > > -- > 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/ed64ea40-5316-437c-ad7c-cb3f77c8bf4d%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/ed64ea40-5316-437c-ad7c-cb3f77c8bf4d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAB1FMuRTYYYdT39s%3Dp53wU9Ze-e6FcCdKC5VP98HaBsgnGb81A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
