user-vms: add config admin exam VMs (#21)

This commit is contained in:
wizzdom 2024-02-12 18:06:58 +00:00 committed by GitHub
parent ff1b340c44
commit f05a112264
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 99 additions and 0 deletions

View file

@ -81,12 +81,16 @@ files can be served by any HTTP server, and the address is placed into the job f
... ...
args = [ args = [
... ...
"virtio-net-pci,netdev=hn0,id=nic1,mac=52:54:84:ba:49:22",
"-smbios", "-smbios",
"type=1,serial=ds=nocloud-net;s=http://136.206.16.5:8000/", "type=1,serial=ds=nocloud-net;s=http://136.206.16.5:8000/",
] ]
... ...
``` ```
> [!NOTE] Note!
> If you're running multiple VMS on the same host make sure to set different MAC addresses for each VM, otherwise you'll have a bad time.
## Creating a new VM ## Creating a new VM
To create a new VM, you'll need to create a new job file and a cloud-init configuration file. Copy To create a new VM, you'll need to create a new job file and a cloud-init configuration file. Copy

View file

@ -0,0 +1,95 @@
job "admin-exams" {
datacenters = ["aperture"]
group "ayden-vm" {
network {
mode = "host"
}
service {
name = "ayden-vm"
}
task "ayden-vm" {
constraint {
attribute = "${attr.unique.hostname}"
value = "chell" # task must be scheduled on a host with the bridge device configured
}
resources {
cpu = 12000
memory = 4096
}
artifact {
source = "http://136.206.16.5:8000/base-images/debian-12-genericcloud-amd64-30G.qcow2"
destination = "local/ayden-vm.qcow2"
mode = "file"
}
driver = "qemu"
config {
image_path = "local/ayden-vm.qcow2"
accelerator = "kvm"
drive_interface = "virtio"
args = [
"-netdev",
"bridge,id=hn0",
"-device",
"virtio-net-pci,netdev=hn0,id=nic1,mac=52:54:84:ba:49:20", # mac address must be unique or else you will regret it
"-smbios",
"type=1,serial=ds=nocloud-net;s=http://136.206.16.5:8000/ayden-vm/",
]
}
}
}
group "hypnoant-vm" {
network {
mode = "host"
}
service {
name = "hypnoant-vm"
}
task "hypnoant-vm" {
constraint {
attribute = "${attr.unique.hostname}"
value = "wheatley"
}
resources {
cpu = 12000
memory = 4096
}
artifact {
source = "http://136.206.16.5:8000/base-images/debian-12-genericcloud-amd64-30G.qcow2"
destination = "local/hypnoant-vm.qcow2"
mode = "file"
}
driver = "qemu"
config {
image_path = "local/hypnoant-vm.qcow2"
accelerator = "kvm"
drive_interface = "virtio"
args = [
"-netdev",
"bridge,id=hn0",
"-device",
"virtio-net-pci,netdev=hn0,id=nic1,mac=52:54:84:ba:49:22",
"-smbios",
"type=1,serial=ds=nocloud-net;s=http://136.206.16.5:8000/hypnoant-vm/",
]
}
}
}
}