Centos7.5 ansible第一次使用模块报错

问题:

[root@m01 ~]# ansible webservers -m ping -i ./hosts
172.16.1.7 | FAILED! => {
"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
}
172.16.1.8 | FAILED! => {
"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
}

产生的原因:

如果控制端和被控制端第一次通讯,需要先添加指纹信息

解决方法:

添加指纹信息
[root@m01 ~]# ssh 172.16.1.7
The authenticity of host '172.16.1.7 (172.16.1.7)' can't be established.
ECDSA key fingerprint is SHA256:KS0T63CVc6vyFB3MHXLjPGCuTL3AIaNR5Jk1D92pW8Q.
ECDSA key fingerprint is MD5:5e:6e:7e:90:16:0c:0e:c3:a2:3d:73:2a:9a:be:40:aa.
Are you sure you want to continue connecting (yes/no)? yes
root@172.16.1.7's password: 输入密码
Last login: Tue Feb 26 15:58:50 2019 from 10.0.0.1
[root@web01 ~]# exit
logout
Connection to 172.16.1.7 closed.
[root@m01 ~]# ansible web01 -m ping -i ./hosts
172.16.1.7 | SUCCESS => {
"changed": false,
"ping": "pong"
}

那如果机器特别多少的情况下怎么办?

仅需开启ansible中的 host_key_checking = False
[root@m01 ~]# vim /etc/ansible/ansible.cfg
host_key_checking = False
[root@m01 ~]# ansible webservers -m ping -i ./hosts
172.16.1.7 | SUCCESS => {
"changed": false,
"ping": "pong"
}
172.16.1.8 | SUCCESS => {
"changed": false,
"ping": "pong"
}

"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to ma的更多相关文章

  1. ansible报错Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this

    安装和配置好ansible,执行命令时报错如下 [root@test01 ansible-install]# ansible test -m shell -a 'w' >> Using a ...

  2. 【转载】What is the difference between authorized_keys and known_hosts file for SSH?

    The known_hosts file lets the client authenticate the server, to check that it isn't connecting to a ...

  3. Add correct host key in /root/.ssh/known_hosts to get rid of this message

    bug: Add correct host key in /root/.ssh/known_hosts to get rid of this message 解决办法: rm ~/.ssh/known ...

  4. 登录ssh时Host key verification failed错误

    工作中总是测试不同的路由设备, 路由器的ip都是 192.168.111.1 ,ssh登录的时候总是出现这个错误. macos上,错误如下 spawn ssh -p 22 root@192.168.1 ...

  5. ssh远程登录出现Host key verification failed.解决办法

    今天通过ssh和域名连接主机: IcarusdeMacBook-Pro:~ icarus$ ssh root@icarusyu.me 出现了如下错误: @@@@@@@@@@@@@@@@@@@@@@@@ ...

  6. 解决ssh登录Host key verification failed

    使用SSH登录某台机器,有时因为server端的一些变动,会出现以下信息: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @    WARNING: R ...

  7. SSH登录失败:Host key verification failed

    转载自:https://help.aliyun.com/knowledge_detail/41471.html 注意:本文相关 Linux 配置及说明已在 CentOS 6.5 64 位操作系统中进行 ...

  8. SSH连接时出现Host key verification failed的原因及解决方法

    SSH连接的时候Host key verification failed. [root@cache001 swftools-0.9.0]# ssh 192.168.1.90@@@@@@@@@@@@@@ ...

  9. ssh无密码登录设置方法以及出现问题 ECDSA host key 和IP地址对应的key不同的解决

    最近在做hadoop,因为要求各主机之间的用户必须相同,且为方便远程登录,需配置无密码登录 先附上ssh无密码登录设置方法: 先生成密钥并配置无ssh无密码登录本机,输入命令: ssh-keygen ...

随机推荐

  1. 30.get和post的区别

    POST和GET的区别 Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符,我们可以这样认为:一个URL地址,它用于描述一个 ...

  2. VS.C#如何向数据数据库中存入和读取图片的

    写入图片部分代码:假设图片为 test.gifbyte [] bytes = File.ReadAllBytes(@"c:\test.gif");SqlConnection con ...

  3. jsp重新打开一个新的页面

    有以下一种实现方式: 1.target="_blank” <a href="document.html" target="_blank"> ...

  4. 前端-CSS样式

    一.CSS介绍 CSS(Cascading Style Sheet),全称层叠样式,定义如何显示HTML内的元素,浏览器读取HTML文件时,读取到CSS样式时根据CSS规则来对内容进行渲染 1.CSS ...

  5. Python全栈-网络编程-TCP粘包

    一.什么是TCP粘包 C/S架构下,接收方不知道每个消息的发送间隙.也不知道每次应该提取多少个字节的数据,与此同时,TCP是面向连接的,面向流的,收发两端都要有,因此发送端为了将多个发往接收端的数据包 ...

  6. js切换背景颜色

    我将全部的代码上传到了github,你可以下载查看 <!-------change the background color--------------> <script> f ...

  7. windows下配置lua环境

    1.进入lua官网http://www.lua.org/ 2.点击download 3.点击get a binary 4.点击[Lua - joedf's Builds] 5.选择适合自己的版本下载, ...

  8. pandas.io.common.CParserError: Error tokenizing data. C error: Expected 1 fields in line 526, saw 5

    pandas.io.common.CParserError: Error tokenizing data. C error: Expected 1 fields in line 526, saw 5 ...

  9. python XML文件解析:用xml.dom.minidom来解析xml文件

    python解析XML常见的有三种方法: 一是xml.dom.*模块,是W3C DOM API的实现,若需要处理DOM API则该模块很合适, 二是xml.sax.*模块,它是SAX API的实现,这 ...

  10. 20165215 2017-2018-2 《Java程序设计》第7周学习总结

    20165215 2017-2018-2 <Java程序设计>第七周学习总结 教材学习内容总结 chapter11 下载安装MySQL服务器 启动MySQL数据库服务器 在bin子目录中, ...