-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
Could you improve support of sudo directly on jenkins server, please?
For example: If you are running jenkins under jenkinsuser and if you want to run ansible as another user, there is no way to accomplish that.
Solution would be add arbitrary string before ansible executable in ansible plugin and edit sudoers like >
/etc/sudoers
jenkinsuser ALL=(anotheruser)NOPASSWD:/usr/bin/ansible-playbook /tmp/* -i /tmp/* * --private-key /home/anotheruser/.ssh/id_rsa_ansible *
final command would be
sudo -u anotheruser-i /bin/bash -l -c '/usr/bin/ansible-playbook /tmp/playbook.yml -i /tmp/inventory -f 5 --private-key /home/anotheruser/.ssh/id_rsa_ansible -vvvv'
Thanks