I using the CentOS-2nics-lb-cluster azure template to create a test environment with two virtual machines. The default admin user is created with this blob.

 "osProfile": {
      "computerName": "[concat('vm', copyIndex())]",
      "adminUsername": "[parameters('adminUsername')]",
      "adminPassword": "[parameters('adminPassword')]"

The sshd config on the azure vms contains

#RSAAuthentication yes
#PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes
UsePAM yes

which seems to indicate that PasswordAuthentication and PubkeyAuthentication are enabled.

I created my own SSH key pair and have copied the public key to the two azure VMs, this allows me to do password-less SSH login.

In my scenario, i want to use ansible scripts to install a database and java application onto the two VM's.

My basic ansible inventory file contained

test01vm0 ansible_host=test01.cloudapp.azure.com ansible_port=50000
test01vm1 ansible_host=test01.cloudapp.azure.com ansible_port=50001

In my 'groups_vars/all' file i have

# ssh access
ansible_connection: ssh

In my 'ansible.cfg' file i have defined the 'private_key_file' value as


I have a simple task which calls the 'become' function

- name: create initial groups for the oracle user
  become: yes
  group: name={{ item }} state=present
    - "{{ oracle_group }}"
    - "{{ oracle_dba_group }}"

and i execute the playbook as

ansible-playbook oracle.yml -vvv --step --sudo

In all cases

<test01.cloudapp.azure.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=50000 -o 'IdentityFile="/home/pc/.ssh/id_rsa.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=admin -o ConnectTimeout=10 -o ControlPath=/home/pc/.ansible/cp/ansible-ssh-%h-%p-%r -tt test01.cloudapp.azure.com '/bin/sh -c '"'"'sudo -H -S  -p "[sudo via ansible, key=kxsxqdhkkyuodnkvedsxmtozowbkltws] password: " -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-kxsxqdhkkyuodnkvedsxmtozowbkltws; LANG=en_IE.UTF-8 LC_ALL=en_IE.UTF-8 LC_MESSAGES=en_IE.UTF-8 /usr/bin/python /home/admin/.ansible/tmp/ansible-tmp-1453477752.42-279575317679267/group; rm -rf "/home/admin/.ansible/tmp/ansible-tmp-1453477752.42-279575317679267/" > /dev/null 2>&1'"'"'"'"'"'"'"'"''"'"''
fatal: [test01vm0]: FAILED! => {"failed": true, "msg": "ERROR! Timeout (12s) waiting for privilege escalation prompt: "}

Can anybody help with a reason why this 'privilege escalation prompt' error occurs? Do i need to set the 'ansible_ssh_user' value?

  • it looks like the connection is waiting for a sudo password. Can you confirm this? Try to ssh <host> 'sudo echo hi' with the same credentials and see if that works. – Bruce Becker Nov 7 '18 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.