# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  # Vagrant virtual machines require a box to build off of.
  config.vm.box = "ubuntu/focal64"
  # Use the default insecure key for these machines
  config.ssh.insert_key = false
  # Forward ssh-agent for cloning from Github.com
  config.ssh.forward_agent = true

  config.vm.define 'db' do |db|

    # Create a private network, which allows host-only access to the machine
    # using a specific IP.
    db.vm.network "private_network", ip: "192.168.56.11"
    db.vm.hostname = "db"

    db.vm.provider "virtualbox" do |vb|
      vb.name = "db"
      # Use VBoxManage to customize the VM. For example to change memory:
      vb.customize ["modifyvm", :id, "--memory", "1024"]
    end
  end

  config.vm.define 'web' do |web|

    # Create a private network, which allows host-only access to the machine
    # using a specific IP.
    web.vm.network "private_network", ip: "192.168.56.10"
    web.vm.hostname = "web"

    web.vm.provider "virtualbox" do |vb|
      vb.name = "web"
      # Use VBoxManage to customize the VM. For example to change memory:
      vb.customize ["modifyvm", :id, "--memory", "1024"]
    end

    web.vm.provision "ansible" do |ansible|
      ansible.limit = 'all'
      ansible.playbook = "playbook.yml"
    ansible.verbose = "vvv"
    ansible.compatibility_mode = "2.0"
    end

  end

end
