Packer templates for building Vagrant boxes customized by Evolix.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Vagrantfile 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. require 'json'
  4. Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
  5. # Load ~/.VagrantFile if exist, permit local config provider
  6. vagrantfile = File.join("#{Dir.home}", '.VagrantFile')
  7. load File.expand_path(vagrantfile) if File.exists?(vagrantfile)
  8. Vagrant.configure('2') do |config|
  9. config.vm.synced_folder '.', '/vagrant', type: "rsync", rsync__exclude: [ '.vagrant', '.git', 'build' ]
  10. templates = []
  11. Dir.glob('./vars/*.json') do |item|
  12. json = File.read("#{item}")
  13. templates.push(JSON.parse(json))
  14. end
  15. templates.each do |template|
  16. config.vm.define "#{template['box_name']}" do |node|
  17. node.vm.hostname = "#{template['box_name']}-#{template['roles_version']}.example.com"
  18. node.vm.box = "debian/stretch64"
  19. node.vm.box_version = "#{template['debian_version']}"
  20. node.vm.provision "shell", path: "scripts/ansible_install_pip", env: { "ANSIBLE_VERSION" => "#{template['ansible_version']}" }
  21. node.vm.provision "shell", path: "scripts/ansible_roles_galaxy", env: { "ROLES_VERSION" => "#{template['roles_version']}" }
  22. node.vm.provision "ansible_local" do |ansible|
  23. ansible.playbook = "ansible/#{template['box_name']}.yml"
  24. ansible.install = false
  25. ansible.playbook_command = ". /tmp/venv/bin/activate && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook"
  26. end
  27. end
  28. end
  29. end