ansible不配ssh連接,用戶密碼登錄


ansible 不配ssh免密鏈接,直接用ssh用戶密碼連接,要先裝sshpass。
否則會報錯:

sshpass安裝

sshpass下載地址:http://sourceforge.net/projects/sshpass/

運行下列命令安裝

tar -zxvf sshpass-1.05.tar.gz
cd sshpass-1.05                
./configure             
make && make install

安裝完成后輸入sshpass出現如下提示即安裝成功:

# sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
   -f filename   Take password to use from file
   -d number     Use number as file descriptor for getting password
   -p password   Provide password as argument (security unwise)
   -e            Password is passed as env-var "SSHPASS"
   With no parameters - password will be taken from stdin
   -h            Show help (this screen)
   -V            Print version information
At most one of -f, -d, -p or -e should be used

hosts 文件中添加用戶密碼,認證ssh連接【不推薦】

# hosts
192.168.69.132 ansible_ssh_user=root ansible_ssh_pass=root


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM