プログラマーの調べ物

プログラマーが調べ物をするときに役に立つサイトを作ります。

Ansibleのpingを使って接続確認をしたら "to use the 'ssh' connection type with passwords, you must install the sshpass program"エラーが出た。

以下のホスト情報で接続を確認。

$ cat hosts
vm-machine ansible_host=192.168.62.130 ansible_port=22 ansible_user=root ansible_ssh_pass=root_pass

以下のコマンド実行。

ansible all -i hosts -m ping

すると、"to use the 'ssh' connection type with passwords, you must install the sshpass program"というエラーが。

vm-machine | FAILED! => {
    "failed": true,
    "msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"
}

https://stackoverflow.com/questions/42835626/to-use-the-ssh-connection-type-with-passwords-you-must-install-the-sshpass-pr

こいつを解消するには、

# yum install sshpass

でsshpassをインストールしておく必要がある。 インストールしたら接続確認が取れた。

$ ansible all -i hosts -m ping
vm-machine | SUCCESS => {
    "changed": false,
    "ping": "pong"
}