diff --git a/.gitignore b/.gitignore index 27717bb..4b94c19 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/.vagrant/** +k3s/sync_folder/** diff --git a/k3s/Vagrantfile b/k3s/Vagrantfile new file mode 100644 index 0000000..a1c00ba --- /dev/null +++ b/k3s/Vagrantfile @@ -0,0 +1,81 @@ +#l-*- mode: ruby -*- +# vi: set ft=ruby : +Vagrant.configure("2") do |config| + + config.vm.define "server" do |server| + server.vm.box = "debian/bookworm64" + server.vm.network "forwarded_port", guest: 8080, host: 8080, host_ip: "127.0.0.1" + server.vm.network "private_network", ip: "192.168.56.2" + server.vm.hostname = "k3s-server" + server.vm.synced_folder "sync_folder/", "/var/tmp/" + server.vm.provider "virtualbox" do |vb| + vb.memory = 2048 + vb.cpus = 2 + end + + server.vm.provision "shell", inline: <<-SHELL + apt update + apt-get install -y locales + sed -i 's/^# *\(en_US.UTF-8 fr_FR.UTF-8 UTF-8\)/\1/' /etc/locale.gen + locale-gen + echo "export LC_ALL=fr_FR.UTF8" >> ~/.bashrc + echo "export LANG=en_US.UTF-8" >> ~/.bashrc + echo "export LANGUAGE=en_US.UTF-8" >> ~/.bashrc + apt install -y curl + curl -sfL https://get.k3s.io | bash - + k3s check-config + cat /var/lib/rancher/k3s/server/node-token | tee > /var/tmp/server_token + cat /var/lib/rancher/node/password | tee > /var/tmp/server_password + SHELL + end +# + config.vm.define "client1" do |client1| + client1.vm.box = "debian/bookworm64" + client1.vm.hostname = "docker" + client1.vm.network "private_network", ip: "192.168.56.3" + client1.vm.hostname = "client1" + client1.vm.synced_folder "sync_folder/", "/var/tmp/" + client1.vm.provider "virtualbox" do |vb| + vb.memory = 1024 + vb.cpus = 1 + end + + client1.vm.provision "shell", inline: <<-SHELL + apt update + apt install -y curl + curl -sfL https://get.k3s.io | K3S_URL=https://192.168.56.2:6443 K3S_TOKEN_FILE=/var/tmp/server_token sh - + cat /var/tmp/server_password > /etc/rancher/node/password + SHELL + end + + config.vm.define "windows" do |windows| + windows.vm.box = "gusztavvargadr/windows-server" + windows.vm.hostname = "windows-server" + windows.vm.network "private_network", ip: "192.168.56.4" + windows.vm.provider "virtualbox" do |vb| + vb.memory = 2048 + vb.cpus = 2 + end + windows.vm.provision "shell", inline: <<-SHELL + $WebClient = New-Object System.Net.WebClient + $WebClient.DownloadFile("https://cdn.zabbix.com/zabbix/binaries/stable/6.0/6.0.9/zabbix_agent2-6.0.9-windows-amd64-openssl.msi","C:\zabbix\zabbix-agent\zabbix-agent2.msi") + Start-Process msiexec.exe -Wait -ArgumentList '/I C:\installers\SQLIO.msi\zabbix-agent2.msi /quiet' + SHELL + end + config.vm.define "pfs" do |pfs| + pfs.vm.box = "xenomii/pfsense-2.6.0" + pfs.vm.hostname = "pfSense" + pfs.vm.network "forwarded_port", guest: 80, host: 8081, host_ip: "127.0.0.1" + pfs.vm.network "forwarded_port", guest: 443, host: 8082, host_ip: "127.0.0.1" + pfs.vm.network "private_network", ip: "192.168.56.5" + pfs.vm.provider "virtualbox" do |vb| + vb.memory = 2048 + vb.cpus = 2 + end + + pfs.vm.provision "shell", inline: <<-SHELL + pkg install pfSense-pkg-zabbix-agent6-1.0.4_12 + SHELL + + end +end