【发布时间】:2022-01-08 16:03:42
【问题描述】:
我正在使用自制软件在 macOS Catalina 上安装 Ansible(我之前也根据文档通过 pip 安装过)。问题是当我尝试使用测试剧本时,我收到以下错误:
target1 | FAILED! => {
"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"
}
问题是 sshpass 在 macOS 上无法通过 homebrew 等轻松获得。我找到了几个安装选项,但在安装之前尝试进行以下更改:
export ANSIBLE_HOST_KEY_CHECKING=False
host_key_checking=false内ansible.cfg同目录
上述更改均无效,我应该只安装 sshpass,还是有其他解决方法?还是我应该只使用 virtualbox 并收工?
作为参考,这是下面的剧本,这是一个简单的 ping 测试,我试图在我已经能够通过 SSH 连接到的本地 Raspberry Pi 上使用它:
-
name: Test connectivity to target servers
hosts: all
tasks:
- name: Ping test
ping:
inventory.txt 文件如下所示:
target1 ansible_host=192.168.x.x ansible_ssh_pass=<password>
【问题讨论】:
标签: macos ansible ansible-inventory sshpass