Vagrant

Simple Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
        config.vm.box = "ubuntu/trusty64"
        config.vm.network "forwarded_port", guest: 80, host: 9080
        config.vm.network "forwarded_port", guest: 443, host: 9443
end

Simple Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Use the same key for each machine config.ssh.insert_key = false

        config.vm.define "vagrant1" do |vagrant1|
                vagrant1.vm.box = "ubuntu/trusty64"
        end

        config.vm.define "vagrant2" do |vagrant2|
                vagrant2.vm.box = "ubuntu/trusty64"
        end

        config.vm.define "vagrant3" do |vagrant3|
                vagrant3.vm.box = "ubuntu/trusty64"
                vagrant3.vm.provision "ansible" do |ansible|
                        ansible.limit = 'all'
                        ansible.playbook = "playbook.yml"
                        ansible.groups = {
                                "web"  =>       ["vagrant1"],
                                "database" => ["vagrant2"],
                                "api" =>            ["vagrant3"]
                        }
                end
        end
 end

 vagrant privison vagrant3

Synced Directories

config.vm.synced_folder ".", "/vagrant", id: "v-root"
config.vm.synced_folder "../vagrant_test_data", "/vagrant_data", :id => "v-data"

Useful Commands

Can you ssh?

ssh -i ~/.vagrant.d/insecure_private_key vagrant@10.0.0.10
ssh -i .vagrant/machines/default/virtualbox/private_key -p 2222 vagrant@10.0.0.10
ssh -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1 -p 2222  
ssh -i .vagrant/machines/default/virtualbox/private_key -p 2222 vagrant@127.0.0.1

Can you ssh with debugging?

ssh debug:

VAGRANT_LOG=debug vagrant ssh

up debug:

vagrant up --debug

Check your config

vagrant ssh-config

What boxes have you got?

vagrant box list

Install Guest Additions

vagrant plugin install vagrant-vbguest