[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

相關文章
相關標籤/搜索