In sudoers file I have only (can't change it)
%user ALL=(ALL) NOPASSWD: /bin/su - jboss
How can I sudo to jboss and then run some command?
I tried something like
- become: yes
become_user: "jboss"
raw: "touch test"
or
raw: "sudo su - jboss -c touch test"
but always ended:
Sorry, user is not allowed to execute 'command' as jboss
Ansible stuffs a lot of voodoo around the actual commands, so it needs
your ansible_user to have NOPASSWD set for all commands.