[root@localhost ~]# ansible testhosts -m command -a 'rm -rf /tmp/haha'
[WARNING]: Consider using the file module with state=absent rather than running 'rm'. If you need to use command
because file is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in
ansible.cfg to get rid of this message. #vim /etc/ansible/ansible.cfg  
  command_warnings=False去掉#,注意要顶格
[root@localhost ~]# ansible-playbook test.yaml
[WARNING]: * Failed to parse /etc/ansible/hosts with yaml plugin: Syntax Error while loading YAML. did not find
expected <document start> The error appears to have been in '/etc/ansible/hosts': line 45, column 1, but may be
elsewhere in the file depending on the exact syntax problem. The offending line appears to be: [testhosts]
192.168.42.9 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=0330 port-100 ^ here [WARNING]: * Failed to parse /etc/ansible/hosts with ini plugin: /etc/ansible/hosts:45: Expected key=value host
variable assignment, got: port-100 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all' #配置文件出错,检查书写是否有问题
[root@localhost ~]# ansible testhosts -m ping
192.168.42.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."
}
192.168.42.9 | 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."
}
192.168.42.10 | 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."
}

碰到这种问题就 vim /etc/ansible/ansible.cfg做如下修改(去掉#)

ansible报错处理的更多相关文章

  1. ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren't installed【转】

    报错内容: TASK [activemq : jvm configuration] ********************************************************** ...

  2. ansible报错AttributeError: module 'urllib.request' has no attribute 'HTTPSHandler'

    报错内容: TASK [activemq : extract activemq tarball] *************************************************** ...

  3. ansible报错Aborting, target uses selinux but python bindings (libselinux-python) aren't installed

    报错内容: TASK [activemq : jvm configuration] ********************************************************** ...

  4. 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 ...

  5. ansible报错:Failed to connect to the host via ssh: Permission denied

    原因: 没有在ansible管理节点(即安装ansible的节点)上添加目标节点(即需要管理的节点)的ssh认证信息. 解决办法: 1.在管理节点生成公钥 ssh-keygen 路径为:~/.ssh/ ...

  6. 关于PyYAML报错问题解决

    转自:http://www.fwqtg.net/%E5%85%B3%E4%BA%8Epyyaml%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86% ...

  7. Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible script 的格式不对,应改成Unix编码

    Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible  script 的格式不对,应改成Unix编码 find . -name "*" | xargs do ...

  8. ansible执行shell模块和command模块报错| FAILED | rc=127 >> /bin/sh: lsof: command not found和| rc=2 >> [Errno 2] No such file or directory

    命令: ansible -i hosts_20 st  -m shell -a 'service zabbix_agentd star'  -K --become ansible -i hosts_2 ...

  9. Ansible 连接主机显示报错的处理方案

    一.在ansible安装完毕后一般需要以SSH的方式连接到需要进行管理的目标主机,一开始遇到了如下问题: 192.168.15.4 | UNREACHABLE! => {    "ch ...

随机推荐

  1. linux基础—课堂随笔_03 SHELL脚本编程基础

    shell脚本编程基础 条件选择:if语句 选择执行: 注意:if语句可嵌套 单分支 if(开头)判断条件:then条件为真的分支代码 fi(结尾) 双分支 if(开头)判断条件:then条件为真的分 ...

  2. 闭包-IIFE

    1)嵌套函数,内部函数访问了外部函数的局部变量,通过返回内部函数,在函数外部调用内部函数,从而更新外部函数的局部变量的过程: 2)代码执行完成之后离开作用域依旧存在 3)有可能发生内存泄露,若对象的引 ...

  3. 一秒钟解决mysql使用游标出现取值乱码问题

    drop procedure if exists pro_test; delimiter // create procedure pro_test() begin declare str varcha ...

  4. 重新学习ESP32(零)之环境搭建——转载——windows平台

    原文来自:https://www.makingfun.xyz/2018/09/18/esp32-hello-world/ 前言 前几天看到乐鑫的公众号推送了一篇文章,说是ESP8266最新的SDK风格 ...

  5. Springboot项目报错【java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader】

    1.发生问题: 升级了JDK9,发现原先的springboot项目起不来了,以为是maven中jdk配置有问题. 于是在pom中添加了 <plugin> <groupId>or ...

  6. hdu 6088 Rikka with Rock-paper-scissors (2017 多校第五场 1004) 【组合数学 + 数论 + 模意义下的FFT】

    题目链接 首先利用组合数学知识,枚举两人的总胜场数容易得到 这还不是卷积的形式,直接搞的话复杂度大概是O(n^2)的,肯定会TLE.但似乎和卷积有点像?想半天没想出来..多谢Q巨提醒,才知道可以用下面 ...

  7. 附:常见的Jdbc Type 与 Java Type之间的关系

    附:常见的Jdbc Type 与 Java Type之间的关系 JDBC Type Java Type CHAR                  String VARCHAR String LONG ...

  8. http 中文乱码

    string RawUrl = request.Request.RawUrl; string cc= HttpUtility.ParseQueryString(RawUrl.Substring(1, ...

  9. tail命令:显示文件结尾的内容

    tail 命令和 head 命令正好相反,它用来查看文件末尾的数据,其基本格式如下:tail [选项] 文件名 选项 含义 -n K 这里的 K 指的是行数,该选项表示输出最后 K 行,在此基础上,如 ...

  10. Volatile关键字的两个作用

    1.保证修饰的变量对所有线程的可见性,这里的“可见性”是指当一条线程修改了这个值,新值对于其他线程来说是可以立即得知的. 2.禁止指令重新排序化