简体   繁体   中英

Ansible: Stuck at connection phase / gathering facts

I keep beating my head against the wall - a few days ago, ansible stopped being able to connect to one of my boxes. It just hangs after the output below. The only stuff I've done to the box recently is to do apt-get upgrade... Nothing else. Worked perfectly before. I'm the only one with rights to access it.

Any hints on where to look? I've tried enabling and disabling sudo in my hosts file, makes no difference.

Command I run:

ansible-playbook site.yml -i hosts.yml -vvvv -u ubuntu

Outputs this and hangs:

<cb2> ESTABLISH CONNECTION FOR USER: ubuntu
<cb2> REMOTE_MODULE setup
<cb2> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/alexweinstein/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 cb2 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python'

Note that I can ssh to the box just fine. Using ansible 1.9.4.

ADDITIONAL INFO:

  • When I try to ssh into the box using the same exact ssh command as what ansible is outputting (see below), the connection goes thru just fine:

ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/alexweinstein/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 cb2

  • Ping command hangs at the same exact point.

ansible all -i hosts.yml -m ping -vvvv

I got the problem solved by upgrading to ansible 2.1. BUT, as long as the verbose output was enabled (ansible-playbook -vvv, or ansible -v), the hang remained! I turned the verbose output off, and the issue went away.

Ansible bug, clearly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM