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