-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
85 lines (76 loc) · 2.36 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- mode: ruby -*-
# vi: set ft=ruby :
hostname = 'kind'
tld = 'test'
vm_ram = '8192'
vm_cpus = '2'
vm_disksize = '200GB'
vm_host_ip = '192.168.61.10'
Vagrant.configure(2) do |config|
if Vagrant::Plugin::Manager.instance.plugin_installed?('vagrant-dns')
config.dns.tld = tld
end
["21.10"].each do |dist|
config.vm.define "#{hostname}" do |node|
node.vm.hostname = hostname
node.vm.network "private_network", ip: vm_host_ip
node.vm.provider :hyperv do |hv|
node.vm.box = "bento/ubuntu-#{dist}"
hv.memory = vm_ram
hv.cpus = vm_cpus
hv.vmname = hostname
hv.vm_integration_services = {
guest_service_interface: true,
time_synchronization: true
}
end
node.vm.provider :virtualbox do |vb|
#node.vm.box = "bento/ubuntu-#{dist}"
node.vm.box = "ubuntu/hirsute64"
if Vagrant::Plugin::Manager.instance.plugin_installed?('vagrant-dns')
vb.customize [
'modifyvm', :id,
'--natdnshostresolver1', 'on'
# some systems also need this:
# '--natdnshostresolver2', 'on'
]
end
# vb.gui = true
vb.memory = vm_ram
vb.cpus = vm_cpus
end
# SSH forwarding so that we can access Github as ourselves
node.ssh.forward_agent = true
node.vm.synced_folder ".", "/vagrant", type: "rsync"
node.disksize.size = vm_disksize
node.vm.provision 'shell' do |shell|
content = %(
apt-get update
apt-get dist-upgrade -y
apt-get install bash-completion python-is-python3 python-dev-is-python3 python3-pip -y
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
pip install ansible
)
shell.inline = content
shell.reboot = true
end
node.vm.provision 'shell' do |shell|
content = %(
echo 'set -g default-terminal "tmux-256color"' >> ~/.tmux.conf
)
shell.inline = content
shell.privileged = false
end
node.vm.provision 'ansible_local' do |ansible|
ansible.install = false
ansible.compatibility_mode = "2.0"
ansible.playbook = 'vagrant_role.yml'
#ansible.install_mode = "pip"
#ansible.verbose = "vvvv"
ansible.extra_vars = {
admin_user: 'ubuntu'
}
end
end
end
end