zoukankan      html  css  js  c++  java
  • ansible报错处理

    [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做如下修改(去掉#)

  • 相关阅读:
    Fluent 18.0新功能之:其他
    【小白的CFD之旅】小结及预告
    【小白的CFD之旅】19 来自计算网格的困惑
    【小白的CFD之旅】18 控制方程基础
    【小白的CFD之旅】23 串行与并行
    【小白的CFD之旅】22 好网格与坏网格
    JS ES6的变量的结构赋值
    JS中some()和every()和join()和concat()和pop(),push(),shift(),unshfit()和map()和filter()
    JS(原生js和jq方式)获取元素属性(自定义属性),删除属性(自定义属性)
    javascript中this的指向问题
  • 原文地址:https://www.cnblogs.com/daisyyang/p/10856830.html
Copyright © 2011-2022 走看看