Ansible root scenario

Hi All,

We have an inquiry regarding ansible.

Presently we have a server, where ansible is installed (say A) and we are running commands to a remote server (say B) using ansible, which tells that ansible is SSH authenticated.

Below is the sequence of steps using which, we login to the server B(manually):

  1. I am logging to a server using user (say abc)
  2. After that, abc needs to become root using pbrun utility (say pbrun /bin/su - ), following which it becomes another user (say xyz) using command su - xyz

In this scenario, we have SSH id_rsa.pub key of user abc in authorized_keys of root .ssh directory. If we do that, we are able to successfully connect, but this approach is not feasible in our case as abc user pub key cannot be placed in root’s ssh directory.

Is there any other alternative to this scenario for ansible so that we don’t have to add the pub key of abc user to root .ssh directory and still be able to use agentless architecture of ansibe?

Let us know if there is any resolution to this issue.

Regards,
Aveek