LoginSignup
0
0

More than 5 years have passed since last update.

ansibleをMac OSXに入れてみた時のメモ

Last updated at Posted at 2015-07-17

前提

vagrantを使って192.168.10.10でVMが作成・起動済

インストール

$ sudo easy_install pip
$ sudo pip install ansible

実行確認

vagrantユーザでpingを実行
$ echo "192.168.10.10" > ~/ansible_hosts
$ ansible all -m ping -c paramiko -u vagrant --ask-pass
鍵を利用する
$ echo "192.168.10.10" > ~/ansible_hosts
$ ansible all -m ping -c paramiko  -u vagrant --private-key=~/.vagrant.d/insecure_private_key 

補足:ssh接続について

ansibleはssh接続にsshpassまたはparamikoを環境に応じて自動的に選択するが、
sshpassはデフォルトでインストールされないため以下のエラーが発生するケースがある
今回は、オプションを指定してansbleインストール時に一緒にインストールされるparamikoを使った

$ ansible all -m ping --ask-pass -u vagrant
SSH password: 
192.168.10.3 | FAILED => to use the 'ssh' connection type with passwords, you must install the sshpass program
0
0
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
0
0