Macでansible sshできない解決編
ansible.cfgの書き方がわかった。
以下のサイトを参考。
https://raw.githubusercontent.com/ansible/ansible/devel/examples/ansible.cfg
[default] を頭につければよいみたい。
よし、実行。
ansible -i inventory vm001.example.local -m ping
vm001.example.local | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue
あれ?やっぱり鍵認証をしているみたい。。。
よくよく調べると以下のオプションをつければ、パスワード認証になるみたい。
--ask-pass
よし!再実行!
ansible -i inventory vm001.example.local -m ping --ask-pass --ask-sudo-pass
SSH password:
vm001.example.local | FAILED => to use the 'ssh' connection type with passwords, you must install the sshpass program
むーおかしい。
さらに調べると以下のような記事が。
Ansible OS X Mavericks You Must Install the sshpass Program
OS X だと、sshpassがないんだね。
ブログにそって、sshpassをインストールし、実行するとようやくできた〜。
疲れた。。。
ansible -i inventory vm001.example.local -m ping --ask-pass
SSH password:
vm001.example.local | success >> {
"changed": false,
"ping": "pong"
}