zzbb 发表于 2018-7-29 13:15:42

[ansible学习笔记]ansible.cfg

  第一个问题:如果客户端不在known_hosts文件里面会出行一些提示
  执行 # ansible IP地址 -m command -a 'date'
  paramiko: The authenticity of host '10.252.129.216' can't be established.
  The ssh-rsa key fingerprint is cef5f02a439420eab5472a6384d14ddc.
  Are you sure you want to continue connecting (yes/no)?
  我不想输入yes或者no,取消这个提示,怎么办?
  很简单,修改ansible.cfg的#host_key_checking= False取消注释,即可。
  第二个问题:如果ansible命令登录需要通过输入命令的服务器,会出现以下错误:
  # ansible app -m shell -a "ls -l /tmp" -u reed
  rhel56-192.168.209.133 | UNREACHABLE! => {
  "changed": false,
  "msg": "No authentication methods available",
  "unreachable": true
  }
  rhel61-192.168.209.142 | UNREACHABLE! => {
  "changed": false,
  "msg": "No authentication methods available",
  "unreachable": true
  }
  解决办法:二选一
  1、要不修改ansible.cfg配置文件的ask_pass= True给取消注释,
  2、要不就在运行命令时候加上-k,这个意思是-k, --ask-pass ask for SSH password
页: [1]
查看完整版本: [ansible学习笔记]ansible.cfg