-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
63 lines (47 loc) · 1.53 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
Vagrant.configure("2") do |config|
###################################################################################
# define number of agents
W = 1
# provision W VMs as agents
(1..W).each do |i|
# name the VMs
config.vm.define "k3sagent#{i}" do |node|
# which image to use
node.vm.box = "opensuse/Leap-15.2.x86_64"
# sizing of the VMs
node.vm.provider "libvirt" do |lv|
lv.random_hostname = true
lv.memory = 2048
lv.cpus = 2
end
# set the hostname
node.vm.hostname = "k3sagent#{i}"
end # config.vm.define agents
end # each-loop agents
###############################################
# name the VMs
config.vm.define "k3sserver" do |node|
# which image to use
node.vm.box = "opensuse/Leap-15.2.x86_64"
# sizing of the VMs
node.vm.provider "libvirt" do |lv|
lv.random_hostname = true
lv.memory = 4096
lv.cpus = 2
end
# set the hostname
node.vm.hostname = "k3sserver"
#################################################
# only target one node to not run ansible twice
# but do not limit this to this node (set ansible.limit to all)
node.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.limit = "all"
ansible.groups = {
"k3sservers" => [ "k3sserver" ],
"k3sagents" => [ "k3sagent1" ]
}
ansible.playbook = "ansible/playbook-vagrant.yml"
end # node.vm.provision
end # config.vm.define servers
end # Vagrant.configure