feat(home-assistant): add Home Assistant module with Nomad job specification
This commit is contained in:
parent
d19cb1203d
commit
d7582b320f
3 changed files with 60 additions and 0 deletions
4
main.tf
4
main.tf
|
@ -29,3 +29,7 @@ module "renovate" {
|
||||||
module "plugin-csi" {
|
module "plugin-csi" {
|
||||||
source = "./modules/plugin-csi"
|
source = "./modules/plugin-csi"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "home-assistant" {
|
||||||
|
source = "./modules/home-assistant"
|
||||||
|
}
|
||||||
|
|
53
modules/home-assistant/jobspec.nomad.hcl
Normal file
53
modules/home-assistant/jobspec.nomad.hcl
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
job "homeassistant" {
|
||||||
|
group "homeassistant" {
|
||||||
|
|
||||||
|
network {
|
||||||
|
port "homeassistant" {
|
||||||
|
static = 8123
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "homeassistant" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "ghcr.io/home-assistant/home-assistant:2025.1.2"
|
||||||
|
network_mode = "host"
|
||||||
|
privileged = true
|
||||||
|
|
||||||
|
volumes = [
|
||||||
|
"/etc/localtime:/etc/localtime:ro",
|
||||||
|
"/run/dbus:/run/dbus:ro"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "config"
|
||||||
|
destination = "/config"
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 500
|
||||||
|
memory = 512
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "config" {
|
||||||
|
type = "csi"
|
||||||
|
read_only = false
|
||||||
|
source = "martinibar_prod_home-assistant_config"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
port = "homeassistant"
|
||||||
|
provider = "consul"
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.homeassistant.entrypoints=websecure",
|
||||||
|
"traefik.http.routers.homeassistant.rule=Host(`homeassistant.brmartin.co.uk`)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
modules/home-assistant/main.tf
Normal file
3
modules/home-assistant/main.tf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
resource "nomad_job" "home-assistant" {
|
||||||
|
jobspec = file("${path.module}/jobspec.nomad.hcl")
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue