Running ansible on local Linux desktop hangs on Gathering Facts

5,440 views
Skip to first unread message

Ben Turner

unread,
Sep 16, 2013, 8:00:44 AM9/16/13
to ansible...@googlegroups.com
Hi,

I've used ansible with some success on remote servers, but wanted to build up a quick playbook to build on dev boxes quickly.

So I wrote out a small playbook to just install some apt packages, and run it - but it seems to get "stuck" at Gathering Facts.

Any idea what might be missing ? I've installed openssh-server on the machine (assuming ansible needs this to connect) and I'm just connecting using my SSH password for now, to avoid any key issues.

I've enclosed the output below, with some verbose logging:

ben@vostro ~/code/ansible_recipes $ ansible-playbook -i hosts -k devbox.yml -vvv
SSH password:
 _________________
< PLAY [devboxes] >
 -----------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


 _________________
< GATHERING FACTS >
 -----------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


<localhost> ESTABLISH CONNECTION FOR USER: ben
<localhost> EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/ben/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'ConnectTimeout=10', 'localhost', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1379332720.77-1201888593115 && chmod a+rx $HOME/.ansible/tmp/ansible-1379332720.77-1201888593115 && echo $HOME/.ansible/tmp/ansible-1379332720.77-1201888593115'"]
<localhost> REMOTE_MODULE setup
<localhost> PUT /tmp/tmpLyL69q TO /home/ben/.ansible/tmp/ansible-1379332720.77-1201888593115/setup
<localhost> EXEC ['sshpass', '-d4', 'ssh', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/ben/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'GSSAPIAuthentication=no', '-o', 'PubkeyAuthentication=no', '-o', 'ConnectTimeout=10', 'localhost', '/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=ulungtivpfjeywjqwqbhuutagtccxvwz] password: " -u root /bin/sh -c \'"\'"\'/usr/bin/python /home/ben/.ansible/tmp/ansible-1379332720.77-1201888593115/setup; rm -rf /home/ben/.ansible/tmp/ansible-1379332720.77-1201888593115/ >/dev/null 2>&1\'"\'"\'\'']


James Cammarata

unread,
Sep 16, 2013, 8:34:24 AM9/16/13
to ansible...@googlegroups.com
It's most likely hung waiting for the sudo password, since you did not also specify the -K option to ansible-playbook. Add that option and you should get past the hang since it will prompt you for the sudo password.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

James Cammarata <jcamm...@ansibleworks.com>
Sr. Software Engineer, AnsibleWorks, Inc.
http://www.ansibleworks.com/

cpat...@xervmon.com

unread,
Sep 16, 2013, 9:10:37 AM9/16/13
to ansible...@googlegroups.com
Ansible performs SSH to the server @ username specified by -u option(the current logged in user if -u is missing). So if you don't have passwordless sudo, then it will prompt you for a password. You are also missing --ask-pass option.

The correct systax is
ansible atlanta -a "/usr/bin/foo" -u username --sudo [--ask-sudo-pass]

Ben Turner

unread,
Sep 16, 2013, 6:58:56 PM9/16/13
to ansible...@googlegroups.com
Many thanks, that was it.

Because I'm used to seeing the following prompts with the -kK options...

SSH password:
sudo password [defaults to SSH password]:

... and because, in this case, they ARE the same value, I'd assumed that the sudo password defaulted to the SSH password. Which it does... but of course it also hangs waiting for user input it if the -K option isn't supplied !

One of those "now I see it, I can't believe I didn't see it" moments.

Cheers,
Ben

Ben Turner

unread,
Mar 19, 2014, 4:20:09 PM3/19/14
to ansible...@googlegroups.com
I actually found this thread because I came across the same problem and now I'm scared because I met another Ben Turner in this exact spot.

ARE YOU ME?

Paul Durivage

unread,
Mar 21, 2014, 12:46:29 PM3/21/14
to ansible...@googlegroups.com
Generally this is related to Ansible somehow waiting for standard input, most commonly for a sudo or su password.  I should note that I make this mistake all the time .  

I'd check to make sure that you haven't set sudo: yes or su: yes somewhere in the playbooks that you're running.  If you have, make sure to set the --ask-sudo-pass, --ask-su-pass arguments on ansible-playbook or use the su_pass, sudo_pass keywords in your tasks.

Best of luck.


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages