Ansible Inventoryファイルでオプション設定
最近はAnsibleをちょこちょこ試してみています。
例えばVagrantで仮想マシンを普通に立ち上げるとポート番号とか認証キーがデフォルト値じゃないので.ssh/config
に以下のように書いたりする。
Host ansible_sample HostName 127.0.0.1 User vagrant Port 2222 IdentityFile /Users/hoge/ansible_sample/.vagrant/machines/default/virtualbox/private_key
するとInventoryファイルは
[web] ansible_sample
と書くだけでよいのだが、いろんなファイル見なきゃいけないのは嫌なのでInventoryファイルだけで完結できないかなと。
Inventoryファイルの書き方を調べてみるといろいろとオプションがあった。
http://docs.ansible.com/intro_inventory.html
上のVagrantの例だとこんな感じ。
[web] 127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=/Users/hoge/ansible_sample/.vagrant/machines/default/virtualbox/private_key