I'm trying to make some tramp / Ansible, but ran into problems from the start. Here is my Vagrantfile:
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "private_network", ip: "192.168.6.66" config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", "2048"] end config.vm.provision "ansible" do |ansible| ansible.playbook = "site.yml" end end
site.yml just
--- - name: Bring up server with MySQL, Nginx, and PHP-FPM hosts: all remote_user: root roles: - common
and common / tasks / main.yml
--- - name: Update apt apt: update_cache=yes
When doing vagrant up output
Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'ubuntu/trusty64'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'ubuntu/trusty64' is up to date... ==> default: Setting the name of the VM: ansible-provision_default_1412793587231_72507 ==> default: Clearing any previously set forwarded ports... ==> default: Fixed port collision for 22 => 2222. Now on port 2200. ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 => 2200 (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2200 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Checking for host entries ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => /Users/bram/Projects/Brammm/ansible-provision ==> default: Running provisioner: ansible... PLAY [Bring up server with MySQL, Nginx, and PHP-FPM] ************************* GATHERING FACTS *************************************************************** fatal: [default] => 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 TASK: [common | Update apt] *************************************************** FATAL: no hosts matched or all hosts have already failed
If I look at .vagrant / provisioners / ansible / inventory / vagrant_ansible_inventory, I see the following:
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2200
I would expect the IP address to be the same as in private_network? I looked at it for more than an hour, did I do something wrong? I have a feeling that IP is not setting properly or something like that. I can ping 192.168.6.66 .
source share