[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. 3.LVS的三种工作模式_TUN模式

    1.TUN模式(Virtual Server via IP Tunneling) 采用NAT模式时,由于请求和响应的报文必须通过调度器地址重写,当客户请求越来越多时,调度器处理能力将成为瓶颈.为了解决 ...

  2. js excel导出功能

    <html> <head> <p style="font-size: 20px;color: red;">使用a标签方式将json导出csv文件 ...

  3. PHP程序员要掌握的技能

    1. Composer 第一点就要提 Composer ,自从 Composer 出现后,PHP 的依赖管理可以变得非常简单.程序内依赖一些类库和框架,直接使用 Composer 引入即可,通过使用 ...

  4. 第八章 watch监听 83 名称案例-使用watch监听文本框数据的变化

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  5. python继承之super

    super() 函数是用于调用父类(超类)的一个方法. super 是用来解决多重继承问题的,直接用类名调用父类方法在使用单继承的时候没问题,但是如果使用多继承,会涉及到查找顺序(MRO).重复调用( ...

  6. Linux 一键部署脚本

    在当前路径下输入 chmod 777 脚本名 给脚本授权, 然后就可以执行脚本 ./脚本名    777 是最高权限,有读.写.执行权限:和属组用户和其他用户的读.写.执行权限. 其他权限分别是 -r ...

  7. 题解 【HEOI2016】tree树

    题面 解析 其实这题可以考虑离线做法,用并查集解决. 因为仔细想,添加标记并不方便, 但如果用并查集记录下祖先, 再一一删除,就会方便很多. 先把每次操作记录下来, 同时记录下每个点被标记的次数(因为 ...

  8. node 打包内存溢出 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

    electron-vue加载了地图 openLayer后,打包就包内存溢出 解决办法: "build": "node --max_old_space_size=4096 ...

  9. How to Fix "Linux Failure to Download extra data files for ttf-mscorefonts-installer" error

    How to Fix "Linux Failure to Download extra data files for ttf-mscorefonts-installer" erro ...

  10. Confluence 6 管理文件

    文件是被附加到 Confluence 的页面上的.请参考 Upload Files 页面中的内容来了解如何附加文件到页面中. 一旦文件被附加到页面上了,你可以下载,删除和编辑这些文件.例如,你可以根据 ...