当我跑:
ansible all -a "/bin/echo hello" -u myuser
我回来了:
mydomain.myhost.com | Failed => Failed to open a SFTP connection (Channel closed.)
我正在尝试连接的受管节点上禁用SFTP子系统.
受管节点上是否需要SFTP? Ansible文档没有特别提到SFTP:http://docs.ansible.com/intro_installation.html#managed-node-requirements
我尝试在ansible.cfg中设置this value:
scp_if_ssh=True
……但它没有效果. (感谢Fred the Magic Wonder Dog for the suggestion.)
我还确保我的非交互式shell不会产生任何输出as suggested here.
解决方法
是的,ansible取决于能够将文件传输到远程计算机.默认情况下,它使用sftp执行此操作.您可以覆盖它以使用scp
scp_if_ssh Occasionally users may be managing a remote system that doesn’t have SFTP enabled. If set to True,we can cause scp to be used to transfer remote files instead: scp_if_ssh=False There’s really no reason to change this unless problems are encountered,and then there’s also no real drawback to managing the switch. Most environments support SFTP by default and this doesn’t usually need to be changed.
以上信息摘自本页:
http://docs.ansible.com/intro_configuration.html#openssh-specific-settings