# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.define "zabbix" do |zabbix| zabbix.vm.box = "debian/bullseye64" zabbix.vm.network "forwarded_port", guest: 8080, host: 8080, host_ip: "127.0.0.1" zabbix.vm.hostname = "zabbix" zabbix.vm.provider "virtualbox" do |vb| vb.memory = 4096 vb.cpus = 2 end zabbix.vm.provision "shell", inline: <<-SHELL apt update apt install -y curl curl -o /tmp/zabbix_6.0.deb https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-4%2Bdebian11_all.deb dpkg -i /tmp/zabbix_6.0.deb apt update -y apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent mariadb-server mariadb-client nginx systemctl enable --now mysql mysql -uroot -e 'create database zabbix character set utf8mb4 collate utf8mb4_bin' mysql -uroot -e 'create user zabbix@localhost identified by "eattherich"' mysql -uroot -e 'grant all privileges on zabbix.* to zabbix@localhost' mysql -uroot -e 'set global log_bin_trust_function_creators = 1' zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -peattherich -D zabbix mysql -uroot -e 'set global log_bin_trust_function_creators = 0;' echo 'DBPassword=eattherich' >> /etc/zabbix/zabbix_server.conf sed -i 's/#//g' /etc/zabbix/nginx.conf sed -i 's/example.com/zabbix.local/g' /etc/zabbix/nginx.conf systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm SHELL end config.vm.define "docker" do |docker| docker.vm.box = "debian/bullseye64" docker.vm.hostname = "docker" docker.vm.provider "virtualbox" do |vb| vb.memory = 1024 vb.cpus = 1 end docker.vm.provision "shell", inline: <<-SHELL apt update apt install -y curl curl -o /tmp/zabbix_6.0.deb https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-4%2Bdebian11_all.deb dpkg -i /tmp/zabbix_6.0.deb apt update -y apt install -y -conf zabbix-agent apt install -y ca-certificates curl gnupg lsb-release mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin systemctl enable --now containerd docker SHELL end config.vm.define "windows_server" do |windows_server| windows_server.vm.box = "gusztavvargadr/windows-server" windows_server.vm.provider "virtualbox" do |vb| vb.memory = 2048 vb.cpus = 2 end windows_server.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_agent-6.0.9-windows-amd64-openssl.msi","C:\zabbix\zabbix-agent\zabbix-agent.msi") Start-Process msiexec.exe -Wait -ArgumentList '/I C:\installers\SQLIO.msi\zabbix-agent.msi /quiet' SHELL end end