我想将 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'"'"''