bra*_*rry 7 linux ssh sftp ansible
当我运行时:
ansible all -a "/bin/echo hello" -u myuser
Run Code Online (Sandbox Code Playgroud)
我回来了:
mydomain.myhost.com | FAILED => failed to open a SFTP connection (Channel closed.)
Run Code Online (Sandbox Code Playgroud)
SFTP 子系统在我尝试连接的受管节点上被禁用。
受管节点上是否需要 SFTP?Ansible 文档没有特别提到 SFTP:http ://docs.ansible.com/intro_installation.html#managed-node-requirements
我尝试在 ansible.cfg 中设置这个值:
scp_if_ssh=True
Run Code Online (Sandbox Code Playgroud)
……但是没有效果。(感谢神奇的神奇狗弗雷德的建议。)
我还确保我的非交互式 shell 不会产生这里建议的任何输出。
是的,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.
Run Code Online (Sandbox Code Playgroud)
以上信息取自本页:
http://docs.ansible.com/intro_configuration.html#openssh-specific-settings