環境
- 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を使う方式になったみたい。
探して見たら、こんな記事があった。