anybody had success with running basic commands using pbrun escalation method? For example I tried below command but it is not working for me.
ansible testserv -i /etc/ansible/testserv -a “uptime” -u someuser -k --become-method=pbrun --become-user=‘sa -u root’ --ask-become-pass -vvvv
Any help is really appreciated.
Thanks
Akash
yes, there are a few people using pbrun, your command looks fine but w/o an error I’m not sure what ‘not working’ means.
Hi Brian,
Thanks for your response. In a normal scenario, I login using ldap user “someuser” and then become root using “pbrun sa -u root” power broker policy. I want to perform root specific tasks with ansible and my organization does not support sudo or su. At the moment I am a beginner with ansible. Please find the command below with verbose output.
ansible testserv -i /etc/ansible/testserv -a “uptime” -u someuser -k --become-method=pbrun --become-user=‘sa -u root’ --ask-become-pass -vvvv
SSH password:
PBRUN password[defaults to SSH password]:
<testserver.com> ESTABLISH CONNECTION FOR USER: someuser on PORT 22 TO testserver.com
<testserver.com> REMOTE_MODULE command uptime
<testserver.com> EXEC /bin/sh -c ‘mkdir -p /tmp/ansible-tmp-1457754722.13-153784741101172 && chmod a+rx /tmp/ansible-tmp-1457754722.13-153784741101172 && echo /tmp/ansible-tmp-1457754722.13-153784741101172’
<testserver.com> PUT /tmp/tmpQmhPG1 TO /tmp/ansible-tmp-1457754722.13-153784741101172/command
<testserver.com> EXEC /bin/sh -c ‘chmod a+r /tmp/ansible-tmp-1457754722.13-153784741101172/command’
<testserver.com> EXEC /bin/sh -c ‘pbrun -b -u sa -u root "’“'”‘echo BECOME-SUCCESS-rhppcyrbglnovowddwgdpbpdkgdsawtt; LANG=C LC_CTYPE=C /usr/bin/python /tmp/ansible-tmp-1457754722.13-153784741101172/command’“'”‘"’
testserver.com | FAILED => ssh connection closed waiting for password prompt
Unhandled exception in thread started by <bound method Transport.__bootstrap of <paramiko.Transport at 0x2e47050L (unconnected)>>
Error in sys.excepthook:
Traceback (most recent call last):
File “/usr/lib64/python2.6/site-packages/abrt_exception_handler.py”, line 204, in
sys.excepthook = lambda etype, value, tb: handleMyException((etype, value, tb))
TypeError: ‘NoneType’ object is not callable
Original exception was:
Traceback (most recent call last):
File “/usr/lib64/python2.6/threading.py”, line 504, in __bootstrap
self.__bootstrap_inner()
File “/usr/lib64/python2.6/threading.py”, line 545, in __bootstrap_inner
(self.name, _format_exc()))
File “/usr/lib64/python2.6/traceback.py”, line 241, in format_exc
etype, value, tb = sys.exc_info()
AttributeError: ‘NoneType’ object has no attribute ‘exc_info’
Below is my ansible.cfg for suing escalation method.
[privilege_escalation]
become=True
#become_method=‘sudo’
become_user=‘root’
#become_ask_pass=False
become_method=‘pbrun’
#become_exe=‘pbrun sa’
Regards,
Akash