Skip to content

Instantly share code, notes, and snippets.

@ajdecon
Created November 3, 2021 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajdecon/5d18a5c5194935c28ecd57b5d4bae948 to your computer and use it in GitHub Desktop.
Save ajdecon/5d18a5c5194935c28ecd57b5d4bae948 to your computer and use it in GitHub Desktop.
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
BOX_IMAGE = "generic/ubuntu2004"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
config.ssh.private_key_path = ["~/.ssh/id_rsa", "~/.vagrant.d/insecure_private_key"]
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
config.vm.define "virtual-mgmt01" do |mgmt|
mgmt.vm.provider "libvirt" do |v|
v.memory = 4096
v.cpus = 4
end
mgmt.vm.box = BOX_IMAGE
mgmt.vm.network :private_network, ip: "10.0.0.2"
end
config.vm.define "virtual-gpu01" do |gpu|
gpu.vm.provider "libvirt" do |v|
v.memory = 16384
v.cpus = 2
v.machine_type = "q35"
v.cpu_mode = "host-passthrough"
end
gpu.vm.box = BOX_IMAGE
gpu.vm.network :private_network, ip: "10.0.0.6"
end
config.vm.provision "shell", inline: <<-SHELL
sed -i -e 's/4\.2\.2\.1/8.8.8.8/g' -e 's/4\.2\.2\.2/8.8.4.4/g' /etc/netplan/01-netcfg.yaml
netplan apply
apt-get update
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment