Tinkerbell.Sandbox/deploy/vagrant/Vagrantfile
Jacob Weinstock 6b841fee7c This simplifies the stand-up of a sandbox:
Only 2 main Vagrant calls are now needed (`vagrant up` and `vagrant up machine1`).
This PR only updates the Vagrant Virtualbox setup. The Vagrant Libvirt and Terraform
still need to be updated.

This uses docker-compose as the entry point for standing up the stack and makes the stand-up
of the sandbox more portal. Vagrant and Terraform are only responsible for standing up infrastructure
and then running docker-compose, not for running any glue scripts.

The docker-compose calls out to single-shot services to do all the glue required to get the fully
functional Tinkerbell stack up and running. All the single-shot services are idempotent.
This increases portability and the development iteration loop. This also simplifies the required
steps needed to get a fully functioning sandbox up and running.

This is intended to help people looking to get started by getting them to a provisioned
machine quicker and more easily.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-08-09 08:04:06 -06:00

44 lines
1.6 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
PROVISIONER_IP = "192.168.50.4"
MACHINE1_IP = "192.168.50.43"
unless Vagrant.has_plugin?("vagrant-docker-compose")
system("vagrant plugin install vagrant-docker-compose")
puts "Dependencies installed, please try the command again."
exit
end
Vagrant.configure("2") do |config|
config.vm.define "provisioner" do |provisioner|
provisioner.vm.box = "generic/ubuntu2004"
provisioner.vm.synced_folder '../', '/vagrant'
provisioner.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
provisioner.vm.network "private_network", ip: PROVISIONER_IP
provisioner.vm.provision :docker
# vagrant plugin install vagrant-docker-compose
provisioner.vm.provision :docker_compose, compose_version: "1.29.1", yml: "/vagrant/docker-compose.yml", run:"always", env: {"TINKERBELL_HOST_IP": PROVISIONER_IP, "TINKERBELL_CLIENT_IP": MACHINE1_IP, "REPO_TOP_LEVEL": "/vagrant"}
end
config.vm.define :machine1, autostart: false do |machine1|
machine1.vm.box = 'jtyr/pxe'
machine1.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
v.gui = true
v.customize ['modifyvm', :id, '--nic1', 'hostonly', '--nic2', 'nat', '--boot1', 'disk', '--boot2', 'net']
v.customize ['setextradata', :id, 'GUI/ScaleFactor', '3.0']
v.check_guest_additions = false
end
machine1.ssh.insert_key = false
machine1.vm.boot_timeout = 10
machine1.vm.synced_folder '.', '/vagrant', disabled: true
machine1.vm.network "private_network", ip: MACHINE1_IP, mac: "0800279EF53A", adapter: 1
end
end