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. c++基础:之封装

         原创: 零灵柒 C/C++的编程教室 2月4日 什么是类 C++是什么?C++设计之初就是class with c,所以简单点说,C++就是带类的C,那么什么是类? 类,简单点说就是类型,在 ...

  2. sqli-labs(七)——登陆处sql注入

    第十三关: 这关也是一个登陆口,和上关所说的一样,先使用'"试一下,让程序报错然后判断后台的sql语句 可以看到后台sql大概是 where name = ('$name')...  这样的 ...

  3. programmatically detect whenever test run is in debug mode

    if (System.Diagnostics.Debugger.IsAttached)    // code or timeout value when running tests in debug ...

  4. eclipse更换workspace需要重新设置的内容

    .jdk Window-->java-->Installed JREs,新增或修改你所需要的jdk版本,点击需要的jdk-->edit 在Default VM arguments里面 ...

  5. python小练习:读入一个考试得分,判断这个分数是哪个等级,并输出,考虑异常场景

    读入一个考试得分,判断这个分数是哪个等级,并输出. 等级:>=90 优 ,>=80且小于90 良,>=70 且小于80,中,>=60且<70及格  <60 不及格 ...

  6. Linux基础命令---显示主机名hostname

    hostname hostname指令用于设置或者显示系统主机名,没有任何参数就会返回gethostname()函数的返回值.使用hostname指令之后,主机名会立马被修改,但是重启系统之后就失效了 ...

  7. 什么是redis,redis简介

    redis是一个key-value存储系统.包括string(字符串).list(链表).set(集合).zset(sorted set --有序集合)和hash(哈希类型). 高可用分布式集群 一, ...

  8. window、linux安装jdk,excel 导入oracle,WebService,window 端口查看,svn服务安装,oracle用户解锁

    内存泄露分析插件http://download.eclipse.org/mat/1.3/update-site/birt插件http://download.eclipse.org//birt/upda ...

  9. linux mysql主从复制

    centos7 安装 mariadb 1 yum 源  -- 配置阿里的 2 rmp 方式 3 源码编译方式  -- 专业DBA 一些知识点: 虚拟环境 不影响 redis/ mariadb/mysq ...

  10. sparkStrming 实时插入 mysql 今天使用echart 实现了简单数据展示 很low 但学习必须加深