Hi

The user you connect as ('becomeuser' - I suppose that's obfuscated)
isn't allowed to do sudo.
If you fix that things are likely to start working.

On a related note, you can remove become_user as that it set to its
default (root), as well as become_method, which default to sudo.
So basically just "become: true" is needed.


Dick


On Thu, 12 Sep 2019 at 13:47, 'Torsten Lorenz' via Ansible Project
<[email protected]> wrote:
>
> Hi @ all,
>
> i try to start/stop a service with ansible adn need to execute the comand 
> with sudo:
>
> executing
> "sudo /usr/bin/systemctl start filebeat.service"
>
> works pretty fine, but i would like to use the service-modul.
>
> My playbook looks like this:
>
>
> -
>         name: testplay
>         hosts: hostname
>
>         tasks:
>          - name: stop filebeat
>            become: true
>            become_method: sudo
>            become_user: root
>            service:
>              name: filebeat.service
>              state: stopped
>
>
>
> i get this error:
>
> ASK [stop filebeat] 
> ************************************************************************************************************************************************************************************************************************
> fatal: [vlq23007]: FAILED! => {"changed": false, "module_stderr": "Shared 
> connection to hostname closed.\r\n", "module_stdout": "Sorry, user sudouser 
> is not allowed to execute '/bin/sh -c echo 
> BECOME-SUCCESS-sodoffndzuoxshzljbtmzwmyfysryhkf; /usr/bin/python 
> /home/sudouser/.ansible/tmp/ansible-tmp-1568288715.75-4453183611448/systemd.py;
>  rm -rf 
> \"/home/sudouser/.ansible/tmp/ansible-tmp-1568288715.75-4453183611448/\" > 
> /dev/null 2>&1' as root on hostname.\r\n", "msg": "MODULE FAILURE", "rc": 1}
>
>
>
> Are there any ideas how to fix it?
>
> greetz
>
> Torsten
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/2ca4e26c-8d54-4a30-a09b-77c70d88b78d%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwN8FswLRy%3DRP-vD-oo%2ByRF_3_sJu%2BDqei-v6Tk0Qh2QpQ%40mail.gmail.com.

Reply via email to