khuedoan-homelab/metal/Vagrantfile
Khue Doan 5ff9cdb8dd fix: fix cannot view logs on dev VM
Failed to create fsnotify watcher: too many open files

https://www.suse.com/support/kb/doc/?id=000020048
2021-12-25 11:04:14 +07:00

37 lines
1.0 KiB
Ruby

# require 'ipaddr' # TODO dynamic IP based on inventory
require 'yaml'
ip_prefix = '192.168.1.'
group_vars = YAML.load_file(File.join(__dir__, './group_vars/all.yml'))
Vagrant.configure("2") do |config|
config.vm.box = "rockylinux/8"
node_count = 1
(0..(node_count-1)).each do |i|
config.vm.define "dev#{i}" do |dev|
dev.vm.network "public_network", ip: "#{ip_prefix}#{200+i+1}"
dev.vm.hostname = "dev#{i}"
dev.vm.disk :disk, size: "128GB", primary: true
end
end
config.vm.provider "virtualbox" do |vb|
vb.cpus = 6
vb.memory = "10240"
end
config.vm.provision "file", source: "#{group_vars['ansible_ssh_private_key_file']}.pub", destination: "/tmp/id_ed25519.pub"
config.vm.provision "shell", inline: <<-SHELL
mkdir /#{group_vars['ansible_user']}/.ssh
cat /tmp/id_ed25519.pub >> /#{group_vars['ansible_user']}/.ssh/authorized_keys
setenforce Permissive
dnf install -y iscsi-initiator-utils
systemctl enable --now iscsid
sysctl fs.inotify.max_user_instances=8192
sysctl -p
SHELL
end