This repository has been archived by the owner on Mar 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
59 lines (48 loc) · 1.57 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def import_rconfig
require 'yaml'
current_dir = File.dirname(File.expand_path(__FILE__))
begin
YAML.load_file("#{current_dir}/dev/config.local.yml")
rescue
YAML.load_file("#{current_dir}/dev/config.yml")
end
end
rconfig = import_rconfig
Vagrant.configure("2") do |config|
if rconfig['provider'] == 'libvirt'
config.vm.provider "libvirt"
else
config.vm.provider "virtualbox"
end
config.vm.box = "debian/buster64"
if rconfig['provider'] == 'libvirt'
config.vm.provider :libvirt do |lv|
lv.memory = rconfig['ram']
lv.cpus = rconfig['cpu']
end
else
config.vm.provider :virtualbox do |vb|
vb.memory = rconfig['ram']
vb.cpus = rconfig['cpu']
vb.customize [
"modifyvm", :id,
"--memory", '%d' % [rconfig['ram']]
]
end
end
config.vm.provision "docker" do |d|
d.pull_images "hello-world" # dummy command (to install docker)
end
config.vm.provision "ansible_local" do |ansible|
ansible.playbook = "/vagrant/dev/playbook.yml"
ansible.verbose = true
ansible.limit = "all"
ansible.inventory_path = "/vagrant/dev/hosts"
#ansible.verbose = "vvv"
ansible.install_mode = "pip"
#ansible.extra_vars = { ansible_python_interpreter:"/usr/bin/python3" }
ansible.extra_vars = {
in_vagrant: true
}
end
end