ansible使用[WARNING]: sftp transfer mechanism failed报错解决方案
目录
ansible使用[WARNING]: sftp transfer mechanism failed报错解决方案
2.[WARNING]: sftp transfer mechanism failed报错解决方案
1.问题报错信息
ansible使用中报错 [root@localhost ~]# ansible vlan -m ping //出现下列报错信息
报错信息
[WARNING]: sftp transfer mechanism failed on [xxx.xxx.xxx.xxx/域名]. Use ANSIBLE_DEBUG=1 to see detailed information
//[WARNING]: sftp传输机制在[xxx.xxx.xxx.xxx/域名]上失败。使用ANSIBLE_DEBUG=1查看详细信息
[root@localhost ~]# ANSIBLE_DEBUG=1 ansible vlan -m ping -vvvvv //使用ANSIBLE_DEBUG=1查看详细信息
2.[WARNING]: sftp transfer mechanism failed报错解决方案
(1)修改ansible的配置文件,保存退出后从新执行ansible报错不存在了
[root@localhost ~]# vim /etc/ansible/ansible.cfg
[ssh_connection]
#Ansible默认使用SSH协议连接对端主机,该部署是主要是SSH连接的一些配置,但配置项较少,多数默认即可
scp_if_ssh=True #Ansible默认使用SSH协议连接对端主机,该部署是主要是SSH连接的一些配置,但配置项较少,多数默认即可
(2)修改sshd_config配置文件,重启sshd即可
[root@localhost ~]# vim /etc/ssh/sshd_config
Subsystem sftp /usr/libexec/openssh/sftp-server
#如果这行注释时,需取消注释,表示即可启用使用sftp