I'm trying to automate some of my manual tasks on a VM. As part of that my VM doesn't have direct root access. So I've to use a different user and then escalate to root. When I try to switch to root user, the password prompt is different than the default prompt. The prompt I see is as shown below
================== [user1@vm-1 tmp]$ su - root
Enter login password:
I wrote a playbook to test the connectivity. The play looks as below
=====================================
hosts: vm-1
any_errors_fatal: true
become: true
become_method: su
become_user: root
gather_facts: no
vars:
ansible_become_pass: "r00t"
tasks:
name: Test me
command: 'echo works'
=====================================
My host file looks as below
localhost ansible_ssh_extra_args='-o StrictHostKeyChecking=no'
vm-1 ansible_ssh_host=1.2.3.4
ansible_connection=ssh
ansible_ssh_user=user1
ansible_ssh_pass=password
ansible_ssh_extra_args='-o StrictHostKeyChecking=no'
=====================================
With this config, when I try to run the play, I'm getting below error
fatal: [vm-1]: FAILED! => {"msg": "Timeout (12s) waiting for privilege escalation prompt: "}
The same playbook works on a different VM but the prompt while trying to switch user to root is simply "Passowrd"
Appreciate your help on this.
By the way I tried this in ansible 2.4, 2.5 versions. In both the releases I got the same error.
Thanks in advance. Ramu