gpt4 book ai didi

Ansible:要使用带密码的 'ssh' 连接类型,您必须安装 sshpass 程序”

转载 作者:行者123 更新时间:2023-12-03 10:36:08 32 4
gpt4 key购买 nike

最近,我在现有项目中创建了名为 spd 的新角色。而其他脚本在设置中运行良好。这个新创建的失败。请指出这里出了什么问题

ansible/roles
spd
tasks
templates
defaults
部署-spd.yml
 - hosts:
roles:
- spd
库存文件
[kube-master]
kubernetes-master-1 ansible_host=10.20.0.225 ansible_user=centos ansible_become=true
kubernetes-master-2 ansible_host=10.20.0.226 ansible_user=centos ansible_become=true
kubernetes-master-3 ansible_host=10.20.0.227 ansible_user=centos ansible_become=true
故障
bash-4.3# ansible-playbook -i inventory/inventory deploy-test-ms.yml --ask-vault-pass
Vault password:

PLAY [kube-master] *************************************************************

TASK [setup] *******************************************************************
Thursday 16 March 2017 13:32:05 +0000 (0:00:00.026) 0:00:00.026 ********
fatal: [kubernetes-master-1]: FAILED! => {"failed": true, "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}
fatal: [kubernetes-master-2]: FAILED! => {"failed": true, "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}
fatal: [kubernetes-master-3]: FAILED! => {"failed": true, "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"}

PLAY RECAP *********************************************************************
kubernetes-master-1 : ok=0 changed=0 unreachable=0 failed=1
kubernetes-master-2 : ok=0 changed=0 unreachable=0 failed=1
kubernetes-master-3 : ok=0 changed=0 unreachable=0 failed=1
更新:
**With failed script**    

Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<10.20.0.227> ESTABLISH SSH CONNECTION FOR USER: centos
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<172.23.169.137> ESTABLISH SSH CONNECTION FOR USER: centos
<10.20.0.225> ESTABLISH SSH CONNECTION FOR USER: centos
<10.20.0.226> ESTABLISH SSH CONNECTION FOR USER: centos

**With successfull script**

Thursday 16 March 2017 14:03:49 +0000 (0:00:00.066) 0:00:00.066 ********
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<10.20.0.237> ESTABLISH SSH CONNECTION FOR USER: centos
<10.20.0.237> SSH: EXEC ssh -F ./ssh.cfg -o ControlMaster=auto -o ControlPersist=30m -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=centos -o ConnectTimeout=30 -o 'ControlPath=~/.ssh/ansible-%r@%h:%p' 10.20.0.237 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1489673029.48-15997231643297
4 `" && echo ansible-tmp-1489673029.48-159972316432974="` echo $HOME/.ansible/tmp/ansible-tmp-1489673029.48-159972316432974 `" ) && sleep 0'"'"''
<10.20.0.237> PUT /tmp/tmpnHJPbc TO /home/centos/.ansible/tmp/ansible-tmp-1489673029.48-159972316432974/setup.py
<10.20.0.237> SSH: EXEC scp -F ./ssh.cfg -o ControlMaster=auto -o ControlPersist=30m -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=centos -o ConnectTimeout=30 -o 'ControlPath=~/.ssh/ansible-%r@%h:%p' /tmp/tmpnHJPbc '[10.20.0.237]:/home/centos/.ansible/tmp/ansible-tmp-1489673029.48-159972316432974/setup.py'
<10.20.0.237> ESTABLISH SSH CONNECTION FOR USER: centos
<10.20.0.237> SSH: EXEC ssh -F ./ssh.cfg -o ControlMaster=auto -o ControlPersist=30m -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=centos -o ConnectTimeout=30 -o 'ControlPath=~/.ssh/ansible-%r@%h:%p' 10.20.0.237 '/bin/sh -c '"'"'chmod u+x /home/centos/.ansible/tmp/ansible-tmp-1489673029.48-159972316432974/ /home/cento
s/.ansible/tmp/ansible-tmp-1489673029.48-159972316432974/setup.py && sleep 0'"'"''

最佳答案

是主机需要sshpass程序安装。对于16.04这样的Ubuntu机器,就很简单apt-get install sshpass .再次,此错误消息:

ERROR! to use the 'ssh' connection type with passwords, you must install the sshpass program



适用于 HOST(供应商)而不是 GUEST(被供应的机器)。这样安装 sshpass在供应商上。

For installing sshpass on Mac OS refer to this link

关于Ansible:要使用带密码的 'ssh' 连接类型,您必须安装 sshpass 程序”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42835626/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com