# Use this Vagrantfile to test individual Ansible roles.
MEMORY = 2048
CPU_COUNT = 2

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

  config.vm.box     = "xenial64"
  config.vm.box_url = "http://files.vagrantup.com/xenial64.box"

  config.vm.network :private_network, ip: "192.168.33.20"
  config.vm.network :forwarded_port, guest: 8080, host: 8080

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]

    # You can adjust this to the amount of CPUs your system has available
    vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
  end

  config.vm.provision :ansible do |ansible|
    # point Vagrant at the location of your playbook you want to run
    ansible.playbook = "../../../playbooks/run_role.yml"
    ansible.verbose = "extra"
    ansible.extra_vars = {
      role: ENV['VAGRANT_ANSIBLE_ROLE']
    }
    if ENV['VAGRANT_ANSIBLE_VARS_FILE']
      ansible.raw_arguments = [ '-e@' + ENV['VAGRANT_ANSIBLE_VARS_FILE']]
    end
  end
end