-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
96 lines (83 loc) 路 3.18 KB
/
Copy pathVagrantfile
File metadata and controls
96 lines (83 loc) 路 3.18 KB
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
86
87
88
89
90
91
92
93
94
95
96
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
VAGRANTFILE_API_VERSION = "2"
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
BOX_NAME = "celavi/debian12-k8s"
BOX_VERSION = "1.33.20"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
config.vm.box = BOX_NAME
config.vm.box_version = BOX_VERSION
# Base VM OS configuration.
config.vm.boot_timeout = 900
config.vm.graceful_halt_timeout=100
# Ensure all vagrant boxes use the same SSH key
config.ssh.insert_key = false
# Enable agent forwarding over SSH connections
config.ssh.forward_agent = true
# Disable automatic box update checking
config.vm.box_check_update = false
# Disable vagrant synced folder
config.vm.synced_folder ".", "/vagrant", disabled: true, id: "vagrant-root"
# General VirtualBox VM configuration.
config.vm.provider :virtualbox do |v|
v.memory = 512
v.cpus = 1
v.linked_clone = true
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
v.customize ["modifyvm", :id, "--cableconnected1", "on"]
v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]
end
## Vagrant Plugins
# vagrant-vbguest
# set auto_update to false, if you do NOT want to check the correct
# additions version when booting this machine
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
# Vagrant Host Manager
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
end
# K8s agent nodes (2 CPU, 4096 MB RAM) - configuration to be handled by ansible provisioning
(1..2).each do |i|
config.vm.define "k8s-node-#{i}" do |node|
node.vm.hostname = "k8s-node-#{i}"
node.vm.network "private_network", ip: "192.168.33.2#{i}"
node.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 2
end
end
end
# K8s server node (2 CPU, 2GB RAM) - configuration to be handled by ansible provisioning
config.vm.define "k8s" do |node|
node.vm.hostname = "k8s"
node.vm.network "private_network", ip: "192.168.33.20"
node.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
end
# Run Ansible provisioner once for all VMs at the end.
node.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "./ansible/provision.yml"
ansible.inventory_path = "./ansible/inventory.yml"
ansible.limit = "all"
# ansible.verbose = "vv" # Uncomment for verbose output
end
end
end