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

unless Vagrant.has_plugin?('vagrant-hostmanager')
  # Attempt to install ourself. Bail out on failure so we don't get stuck in an
  # infinite loop.
  system('vagrant plugin install vagrant-hostmanager') || exit!

  # Relaunch Vagrant so the plugin is detected. Exit with the same status code.
  exit system('vagrant', *ARGV)
end

Vagrant.configure("2") do |config|
  config.vm.box = "autos.box"
  config.vm.network "private_network", ip: "192.168.33.13"
  config.vm.synced_folder "./", "/opt/autos_bb"

   config.vm.provider "virtualbox" do |vb|
      vb.customize [
          "modifyvm", :id,
          "--memory", 4096,
          "--name", "autos_bb.local"
      ]
    end

    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.ignore_private_ip = false
    config.hostmanager.include_offline = true
    config.hostmanager.aliases = %w(
      autos_bb.local
    )

  config.ssh.username = "ubuntu"
  config.ssh.password = "bobadilla"

  config.vm.provision "shell", inline: <<-SHELL
     apt-get update
     apt-get install -y apache2 php7.0 php7.0-cli composer php7.0-mbstring php7.0-zip php7.0-xsl php7.0-xml php7.0-intl php7.0-soap libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-gd
     cd /opt/autos_bb
     composer install
  SHELL
end
