系统版本
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
openssl-1.0.1e-30.el6.x86_64
openssh-server-5.3p1-104.el6.x86_64
openswan-2.6.32-37.el6.x86_64
openssh-5.3p1-104.el6.x86_64
openssh-clients-5.3p1-104.el6.x86_64
openssl-devel-1.0.1e-30.el6.x86_64
opensp-1.5.2-12.1.el6.x86_64
ansible版本
ansible 2.2.0 (devel 73f06e67df) last updated 2016/07/28 17:06:38 (GMT +800)
lib/ansible/modules/core: (detached HEAD 24db4de245) last updated 2016/07/28 17:14:34 (GMT +800)
lib/ansible/modules/extras: (detached HEAD db979dde74) last updated 2016/07/28 17:15:11 (GMT +800)
config file =
configured module search path = Default w/o overrides
目标机器需要ssh key登录, 且 key 需要输入密码
现象: 第一次发起连接的时候, 总是报错; 第二次则可以正常执行
[root@test ip]# ansible -vvvv test -e 'ansible_ssh_user=root' --private-key=/root/bin/.key/id_rsa -m ping
No config file found; using defaults
Loaded callback minimal of type stdout, v2.0
Using module file /root/ansible/lib/ansible/modules/core/system/ping.py
<xx.xx.xx.xx> ESTABLISH SSH CONNECTION FOR USER: root
<xx.xx.xx.xx> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/root/bin/.key/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r xx.xx.xx.xx '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470306129.03-107348505591642 `" && echo ansible-tmp-1470306129.03-107348505591642="` echo $HOME/.ansible/tmp/ansible-tmp-1470306129.03-107348505591642 `" ) && sleep 0'"'"''
Enter passphrase for key '/root/bin/.key/id_rsa':
xx.xx.xx.xx | FAILED! => {
"failed": true,
"msg": "failed to resolve remote temporary directory from ansible-tmp-1470306129.03-107348505591642: `( umask 77 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1470306129.03-107348505591642 `\" && echo ansible-tmp-1470306129.03-107348505591642=\"` echo $HOME/.ansible/tmp/ansible-tmp-1470306129.03-107348505591642 `\" )` returned empty string"
}
试了很多老外的方法, 都没有解决, 那个崩溃啊:
https://github.com/ansible/ansible/issues/13876
https://github.com/ansible/ansible/issues/14465
https://github.com/FreiFunkMuenster/ansible-ffms/issues/38
拍脑袋, 把 openssh openssl 升级一把...
openssh-clients-5.3p1-118.1.el6_8.x86_64
openssl-1.0.1e-48.el6_8.1.x86_64
openssh-5.3p1-118.1.el6_8.x86_64
openssl-devel-1.0.1e-48.el6_8.1.x86_64
openssh-server-5.3p1-118.1.el6_8.x86_64
现象消失... TOT