ssh connection closed waiting for a privilege escalation password prompt

931 views
Skip to first unread message

Mark Woon

unread,
Jun 8, 2015, 6:46:33 PM6/8/15
to ansible...@googlegroups.com
After going from 1.7.1 to 1.9.1 I'm getting "ssh connection closed waiting for a privilege escalation password prompt" errors.  I tried switching to using the new become directives, but I'm still having problems.

Here's the simplest test case I've come up with:

test.yml:

---
- hosts: my.server.org
  become: yes
  vars:
    - user: testuser


  tasks:
  - command: /usr/bin/whoami
    register: foo
    become_user: "{{ user }}"

  - debug: msg="whoami = {{ foo.stdout }}"

  - name: copy file
    copy: src=foo.txt dest=/home/{{ user }}/test.txt
    become_user: "{{ user }}"



hosts.ini:




group_vars/ubuntu.yml:

---
ansible_ssh_user:  admin
ansible_become_pass: xxxxxxxx



And the output:

PLAY [my.server.org] ***********************************************

GATHERING FACTS ***************************************************************

TASK: [command /usr/bin/whoami] ***********************************************
changed: [my.server.org]

TASK: [debug msg="whoami = {{ foo.stdout }}"] *********************************
ok: [my.server.org] => {
    "msg": "whoami = testuser"
}

TASK: [copy file] *************************************************************
fatal: [my.server.org] => ssh connection closed waiting for a privilege escalation password prompt

FATAL: all hosts have already failed -- aborting



Where am I going wrong?  Any help would be greatly appreciated.


Thanks,
-Mark


Simon Pierre Desrosiers

unread,
Dec 15, 2015, 1:29:12 PM12/15/15
to Ansible Project
Hello all,

I have the exact same problem.  In a brand new directory, with new ansible.cfg file and hosts file the following playbook fails when I ask the password to do sudo, but only with the file module, the command module works just fine.
---
- name: yaml de test de fail.
  hosts
: acceptation
  gather_facts
: False
  tasks
:
   
   
- name: test script general
      command
: id
     
register: uid
      become
: yes
      become_user
: wso2
#    - debug: var=uid
   
- debug: msg="{{uid.stdout}}"
 
   
- name: copy file tmp
      copy
: src=files/blabla.txt dest=/tmp/blabla.txt
      become
: yes
      become_user
: wso2

Here is the output :

[Ananke:: 13:09] [Ansible/wso2/TestFails] > ansible-playbook fail.yml --ask-sudo-pass

SUDO password: 


PLAY [yaml de test de fail.] ************************************************** 


TASK: [test script general] *************************************************** 

changed: [acceptation]


TASK: [debug msg="{{uid.stdout}}"] ******************************************** 

ok: [acceptation] => {

    "msg": "uid=500(wso2) gid=500(wso2) groups=500(wso2) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023"

}


TASK: [copy file tmp] ********************************************************* 

fatal: [acceptation] => ssh connection closed waiting for a privilege escalation password prompt


FATAL: all hosts have already failed -- aborting


PLAY RECAP ******************************************************************** 

           to retry, use: --limit @/Users/simonpie/fail.retry


acceptation                : ok=2    changed=1    unreachable=1    failed=0   


[Ananke:: 13:10] [Ansible/wso2/TestFails] > 


Whilst everything works perfectly if I add the NOPASSWD to the sodoer file fo the user I use to log into the machine.

Here is the ansible.cfg file :

[Ananke:: 13:10] [Ansible/wso2/TestFails] > more ansible.cfg 

[defaults]

hostfile = hosts

private_key_file = ~/.ssh/id_rsa

library = /Users/ME/Documents/Ansible/wso2/.library


[Ananke:: 13:15] [Ansible/wso2/TestFails] > 

the hosts file :

[Ananke:: 13:15] [Ansible/wso2/TestFails] > more hosts 

[loc]

local ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=/Users/ME/Documents/Ansible/wso2/.vagrant/machines/default/virtualbox/private_key cutename=vmwso2



[dev]

lab ansible_ssh_host=IP ansible_ssh_user=devME ansible_ssh_private_key_file=~/.ssh/id_rsa cutename=labwso2


[accept]

acceptation ansible_ssh_host=otherIP ansible_ssh_user=accME ansible_ssh_private_key_file=~/.ssh/id_rsa cutename=accwso2


[Ananke:: 13:16] [Ansible/wso2/TestFails] > 


I have check that all the files mentioned in the ansible-playbook manual pages do not exist.  Any idea what could go wrong here ?
Reply all
Reply to author
Forward
0 new messages