LoginSignup
5
6

More than 5 years have passed since last update.

ansible sshpass error

Last updated at Posted at 2017-09-21

環境

  • macOS Sierra
  • brewでansibleをアップグレード(2.2.2.0 -> 2.3.2.0)

症状

brewでansibleをアップグレードした直後、sshpass errorが発生した。

  • アップグレードの前
% ansible local -m ping
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

% ansible web1 -m ping
web1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
  • アップグレードの後、localでは問題がなかったが、sshで接続するサーバーではsshpass errorが発生した。
% ansible local -m ping
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

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

対応

  • エラーメッセージで言われた通りsshpassをインストールする。
  • brewで設置しようとしたら、sshpassがない!
% brew info sshpass
Error: No available formula with the name "sshpass"
We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.
  • ググって見たら、brewでも設置する方法があった。
% brew install http://git.io/sshpass.rb
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

######################################################################## 100.0%
==> Downloading http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz
==> Downloading from https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sshpass/1.05
==> make install
🍺  /usr/local/Cellar/sshpass/1.05: 9 files, 40.8KB, built in 12 seconds
  • もう一度、試して見た。
% ansible web1 -m ping
web1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

解決!

よくわからないけど、ansibleがバージョンアップされてsshpassを使う方式になったみたい。

探して見たら、こんな記事があった。

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6