====Multiple Boxes ==== Vagrant is often used to manage MANY virtual machines. Therefore we need to be able to provide many customized configurations. In the following example, you can see 2 virtual box configurations Vagrant.configure("2") do |config| config.ssh.insert_key = true config.vm.provider "virtualbox" do |vb| vb.gui = true vb.memory = "1534" end config.vm.define "ainsible" do |app| app.vm.box = "centos/7" app.ssh.username = 'root' app.ssh.password = 'vagrant' app.vm.network "private_network", ip: "192.168.10.2" app.vm.network "public_network" # app.ssh.forward_agent = true app.ssh.insert_key = true end config.vm.define "app1" do |app| app.vm.hostname = "orc-app1.dev" app.vm.box = "centos/7" app.ssh.username = 'root' app.ssh.password = 'vagrant' app.vm.network "private_network", ip: "192.168.10.3" end The first part of the configuration is the general configuration for all boxes. As you can see, we have enabled GUI for all machines and we have enabled 1534 MBs of Virtual memory (RAM). The next part is configuration for a box called: ainsible and the other for a box called: app1 ====Rsync Back==== By default, vagrant rsync shared folders from the host (where vagrant runs) -> the target machine. So if we want to download any files generated on the target servers, to be used by the others, using the host as proxy. We have to install a specific plugin. andonovj@DESKTOP-N65RKDP /cygdrive/d/Virtuals/Docker Swarm $ vagrant plugin install vagrant-rsync-back Installing the 'vagrant-rsync-back' plugin. This can take a few minutes... Fetching: vagrant-rsync-back-0.0.1.gem (100%) Installed the plugin 'vagrant-rsync-back (0.0.1)'! andonovj@DESKTOP-N65RKDP /cygdrive/d/Virtuals/Docker Swarm $ vagrant rsync-back mgr1 ==> mgr1: Rsyncing folder: /vagrant/ => /cygdrive/d/Virtuals/Docker Swarm ==== Possible Errors ==== In case you receive the following error: ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: root default: SSH auth method: private key default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... Assure that the password for the user (in our case root) is the same as the vagrant file AND ensure that the rootlogin is enable and the password authentication is also enabled. ====Install VirtualBox Guest Addition==== When you will want to create a shared folders between the virtual box and the host machine. You need a VirtulBox Guest addition, which can be installed as follows: C:\Users\julie\VirtualBox VMs\OUD>vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Fetching vagrant-vbguest-0.30.0.gem Successfully uninstalled vagrant-vbguest-0.21.0 Installed the plugin 'vagrant-vbguest (0.30.0)'! C:\Users\julie\VirtualBox VMs\OUD> <