![从远程主机复制到远程主机时 Ansible 挂起](https://linux22.com/image/666232/%E4%BB%8E%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E5%A4%8D%E5%88%B6%E5%88%B0%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E6%97%B6%20Ansible%20%E6%8C%82%E8%B5%B7.png)
我想将 hostA 上生成的文件复制到生产服务器,并尝试了下面的任务,但 Ansible 挂起了。我ssh_args=-i ForwardAgent=yes
按照建议进行设置上一篇但这没有效果。这里的问题是什么?
- name: Copy certificate from hostA to production servers
synchronize:
mode: pull
src: /etc/td-agent/ca_cert.pem
dest: /etc/td-agent/ca_cert.pem
delegate_to: "{{item}}"
with_items: groups.production
更新:日志如下:
TASK: [td-agent | Copy certificate to sender]
<192.168.50.3> ESTABLISH CONNECTION FOR USER: foo
<192.168.50.3> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=foo -o ConnectTimeout=10 192.168.50.3 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731 && echo $HOME/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731'
<192.168.50.3> PUT /tmp/user/1000/tmpocwPOc TO /home/foo/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731/synchronize
<192.168.50.3> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=foo -o ConnectTimeout=10 192.168.50.3 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=wklthazqaiqrywuyoafjdpxwmqrpklyt] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-wklthazqaiqrywuyoafjdpxwmqrpklyt; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/kuma/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731/synchronize; rm -rf /home/foo/.ansible/tmp/ansible-tmp-1441765316.04-268038164469731/ >/dev/null 2>&1'"'"''