homelab/Vagrantfile

51 lines
1.1 KiB
Ruby
Raw Normal View History

# -*- mode: ruby -*-
# vi: set ft=ruby :
2021-04-15 06:43:24 +00:00
SSH_FORWARD=ENV["SSH_FORWARD"]
if !(SSH_FORWARD == "true")
SSH_FORWARD = false
end
2021-04-15 06:43:24 +00:00
PLAYBOOK=ENV["PLAYBOOK"]
if !PLAYBOOK
if File.exist?('.playbook')
PLAYBOOK = IO.read('.playbook').split("\n")[0]
end
if !PLAYBOOK || PLAYBOOK.empty?
PLAYBOOK = "\nERROR: Set env PLAYBOOK"
end
else
File.write(".playbook", PLAYBOOK)
end
Vagrant.configure("2") do |config|
2022-05-19 04:39:42 +00:00
config.vm.box = "debian/bullseye64"
config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder "./scratch", "/vagrant/scratch"
2021-04-15 06:43:24 +00:00
config.ssh.forward_agent = SSH_FORWARD
# Machine Name
config.vm.define :moxie do |moxie| #
end
config.vm.provider :libvirt do |libvirt|
2022-05-20 03:19:09 +00:00
libvirt.cpus = 2
libvirt.memory = 4096
libvirt.default_prefix = ""
end
2020-06-13 05:12:23 +00:00
config.vm.provider "virtualbox" do |vbox|
vbox.memory = 4096
2020-06-13 05:12:23 +00:00
end
# Provision with Ansible
config.vm.provision "ansible" do |ansible|
ENV['ANSIBLE_ROLES_PATH'] = File.dirname(__FILE__) + "/roles"
ansible.compatibility_mode = "2.0"
ansible.playbook = "dev/" + PLAYBOOK + ".yml"
end
end