Skip to content

Instantly share code, notes, and snippets.

@mister2d
Created March 18, 2021 01:12
Show Gist options
  • Save mister2d/bf80f8c510f962a39a6d7050752adf52 to your computer and use it in GitHub Desktop.
Save mister2d/bf80f8c510f962a39a6d7050752adf52 to your computer and use it in GitHub Desktop.
Simple Nomad job to deploy a VM using the qemu driver.
job "resinstack-small" {
datacenters = ["home"]
group "qcow2" {
constraint {
attribute = "${meta.node_type}"
value = "metal"
}
network {
port "ssh" {}
}
update {
max_parallel = 1
health_check = "checks"
min_healthy_time = "0s"
healthy_deadline = "5m"
progress_deadline = "10m"
auto_revert = true
canary = 0
stagger = "30s"
}
task "server" {
driver = "qemu"
resources {
memory = 4096
cpu = 2048
}
service {
name = "res01"
port = "ssh"
check {
name = "healthcheck"
type = "tcp"
port = "ssh"
interval = "10s"
timeout = "2s"
}
}
config {
image_path = "local/aio.qcow2"
accelerator = "kvm"
args = ["-device", "e1000,netdev=user.0", "-netdev", "user,id=user.0,hostfwd=tcp::${NOMAD_PORT_ssh}-:22"]
}
artifact {
source = "https://web.ingress.service.consul/images/aio.qcow2"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment