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