vagrant provisionした時に
shell
1PLAY [vagrants] **************************************************************** 2 3TASK [setup] ******************************************************************* 4fatal: [192.168.33.10]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true} 5 to retry, use: --limit @./ansible/provisioning/playbook.retry 6 7PLAY RECAP ********************************************************************* 8192.168.33.10 : ok=0 changed=0 unreachable=1 failed=0 9 10Ansible failed to complete successfully. Any error output should be 11visible above. Please fix these errors and try again.
と言われるので,個人的にはansibleがvagrantによって作成されたVB Guest PCにSSH接続できていないのが原因だと思っているのですが,どのように直したらよいかわかりません.
ansible.cfgには
config
1[defaults] 2hostfile = ./ansible/provisioning/hosts 3ansible_ssh_user = vagrant 4ansible_ssh_private_key_file = ./.vagrant/machines/default/virtualbox/private_key 5deprecation_warnings = False 6ssh_args = -F ssh.config
としており,vagrantのansible_ssh_private_key_fileでprivate keyを指定しております.
Vagrantfileは
Vagrantfile
1VAGRANTFILE_API_VERSION = "2" 2 3Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 4 config.vm.box = "ubuntu/trusty64" 5 6 config.vm.network "private_network", ip: "192.168.33.10" 7 config.vm.network "forwarded_port", host: 6060, guest: 6006 8 9 config.vm.synced_folder "./", "/home/vagrant" 10 11 config.vm.provision "ansible" do |ansible| 12 ansible.playbook = "./ansible/provisioning/site.yml" 13 ansible.inventory_path = "./ansible/provisioning/hosts" 14 ansible.limit = 'all' 15 end 16end
となっており,directry treeは
├── Vagrantfile ├── ansible.cfg └── ansible/ └── provisioning/ ├── hosts └── site.yml
としています.
ansible 192.168.33.10 -m pingと打つと
[WARNING]: Host file not found: /usr/local/etc/ansible/hosts [WARNING]: provided hosts list is empty, only localhost is available
となります.
環境:
OSX 10.11.4
vagrant 1.8.1
ansible 2.0.2.0
回答2件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。