[ansible学习笔记]ansible.cfg

第一个问题:若是客户端不在known_hosts文件里面会出行一些提示shell

执行 # ansible IP地址 -m command -a 'date'服务器

paramiko: The authenticity of host '10.252.129.216' can't be established.oracle

The ssh-rsa key fingerprint is cef5f02a439420eab5472a6384d14ddc.app

Are you sure you want to continue connecting (yes/no)? ssh

我不想输入yes或者no,取消这个提示,怎么办?ide

很简单,修改ansible.cfg的#host_key_checking= False取消注释,便可。spa

第二个问题:若是ansible命令登陆须要经过输入命令的服务器,会出现如下错误:ci

[root@reedoracle ansible]# ansible app -m shell -a "ls -l /tmp" -u reedit

rhel56-192.168.209.133 | UNREACHABLE! => {io

   "changed": false,

   "msg": "No authentication methods available",

   "unreachable": true

}

rhel61-192.168.209.142 | UNREACHABLE! => {

   "changed": false,

   "msg": "No authentication methods available",

   "unreachable": true

}

解决办法:二选一

一、要不修改ansible.cfg配置文件的ask_pass= True给取消注释,

二、要不就在运行命令时候加上-k,这个意思是-k, --ask-pass ask for SSH password

相关文章
相关标签/搜索