diff --git a/main.tf b/main.tf index ad269d0..98df4f8 100644 --- a/main.tf +++ b/main.tf @@ -1,19 +1,19 @@ terraform { backend "consul" { - address = "http://10.64.0.2:8500" + address = "http://10.64.2.1:8500" scheme = "http" path = "team/terraform/state" } } provider "nomad" { - address = "http://10.64.0.2:4646" + address = "http://10.64.2.1:4646" region = "homelab-1" alias = "homelab-1" } provider "nomad" { - address = "http://10.64.0.2:4646" + address = "http://10.64.2.1:4646" region = "do-1" alias = "do-1" } @@ -26,6 +26,10 @@ variable "flake_rev" { type = string } +variable "flake_ref" { + type = string +} + variable "flake_host" { type = string } @@ -42,6 +46,7 @@ module "nomad" { source = "./nomad" flake_rev = var.flake_rev + flake_ref = var.flake_ref flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha diff --git a/nomad/main.tf b/nomad/main.tf index 517ca2b..07d79b4 100644 --- a/nomad/main.tf +++ b/nomad/main.tf @@ -13,6 +13,10 @@ variable "flake_rev" { type = string } +variable "flake_ref" { + type = string +} + variable "flake_host" { type = string } @@ -29,6 +33,7 @@ module "regions" { source = "./regions" flake_rev = var.flake_rev + flake_ref = var.flake_ref flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha diff --git a/nomad/regions/do-1/ingress.tf b/nomad/regions/do-1/ingress.tf index 048ee28..395863a 100644 --- a/nomad/regions/do-1/ingress.tf +++ b/nomad/regions/do-1/ingress.tf @@ -15,7 +15,7 @@ resource "nomad_volume" "ingress-letsencrypt" { } context = { - server = "10.64.1.201" + server = "10.64.2.1" share = "/var/nfs/ingress-letsencrypt" } @@ -31,7 +31,7 @@ resource "nomad_job" "ingress" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host_alt}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host_alt}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha upstreams = data.local_file.ingress-upstreams.content diff --git a/nomad/regions/do-1/main.tf b/nomad/regions/do-1/main.tf index cedfedb..3e3ea70 100644 --- a/nomad/regions/do-1/main.tf +++ b/nomad/regions/do-1/main.tf @@ -8,6 +8,10 @@ variable "flake_rev" { type = string } +variable "flake_ref" { + type = string +} + variable "flake_sha" { type = string } diff --git a/nomad/regions/homelab-1/baikal.tf b/nomad/regions/homelab-1/baikal.tf index faa2b9e..e2db30f 100644 --- a/nomad/regions/homelab-1/baikal.tf +++ b/nomad/regions/homelab-1/baikal.tf @@ -50,7 +50,7 @@ resource "nomad_job" "baikal" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/camptules.tf b/nomad/regions/homelab-1/camptules.tf index 2c545b7..0928826 100644 --- a/nomad/regions/homelab-1/camptules.tf +++ b/nomad/regions/homelab-1/camptules.tf @@ -13,7 +13,7 @@ resource "nomad_job" "camptules" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/email.tf b/nomad/regions/homelab-1/email.tf index 96aec7f..b331e75 100644 --- a/nomad/regions/homelab-1/email.tf +++ b/nomad/regions/homelab-1/email.tf @@ -68,7 +68,7 @@ resource "nomad_job" "email" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/gitea.tf b/nomad/regions/homelab-1/gitea.tf index 4b1e94e..11daa75 100644 --- a/nomad/regions/homelab-1/gitea.tf +++ b/nomad/regions/homelab-1/gitea.tf @@ -59,7 +59,7 @@ resource "nomad_job" "gitea" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host_alt}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host_alt}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/home-assistant.tf b/nomad/regions/homelab-1/home-assistant.tf index f5cf3d9..6c5390e 100644 --- a/nomad/regions/homelab-1/home-assistant.tf +++ b/nomad/regions/homelab-1/home-assistant.tf @@ -104,7 +104,7 @@ resource "nomad_job" "home-assistant" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/hydra.tf b/nomad/regions/homelab-1/hydra.tf index 068e6c0..f0df153 100644 --- a/nomad/regions/homelab-1/hydra.tf +++ b/nomad/regions/homelab-1/hydra.tf @@ -85,7 +85,7 @@ resource "nomad_job" "hydra" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/ingress.tf b/nomad/regions/homelab-1/ingress.tf index 4518f02..8caf407 100644 --- a/nomad/regions/homelab-1/ingress.tf +++ b/nomad/regions/homelab-1/ingress.tf @@ -8,7 +8,7 @@ resource "nomad_job" "ingress" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha upstreams = data.local_file.ingress-upstreams.content diff --git a/nomad/regions/homelab-1/job/gitea.hcl b/nomad/regions/homelab-1/job/gitea.hcl index 5e052f6..5e0df48 100644 --- a/nomad/regions/homelab-1/job/gitea.hcl +++ b/nomad/regions/homelab-1/job/gitea.hcl @@ -82,6 +82,15 @@ job "gitea" { flake_ref = "${var.flake_ref}#nixngSystems.gitea.config.system.build.toplevel" flake_sha = var.flake_sha entrypoint = [ "init" ] + + # mounts = [ + # { + # type = "bind" + # target = "/var/nfs/gitea-data" + # source = "/data/gitea" + # options = ["rbind","rw","x-mount.mkdir"] + # } + # ] } env { diff --git a/nomad/regions/homelab-1/job/home-assistant.hcl b/nomad/regions/homelab-1/job/home-assistant.hcl index 26e1622..51ac923 100644 --- a/nomad/regions/homelab-1/job/home-assistant.hcl +++ b/nomad/regions/homelab-1/job/home-assistant.hcl @@ -152,7 +152,7 @@ EOF memory = 128 memory_max = 256 } - + volume_mount { volume = "home-assistant_mosquitto" destination = "/var/mosquitto" @@ -246,6 +246,7 @@ LATITUDE={{ .Data.data.latitude }} LONGTITUDE={{ .Data.data.longtitude }} ELEVATION={{ .Data.data.elevation }} TIME_ZONE={{ .Data.data.time_zone }} +ALARM_CODE={{ .Data.data.alarm_code }} {{ end }} EOF destination = "secrets/environment" diff --git a/nomad/regions/homelab-1/job/jellyfin.hcl b/nomad/regions/homelab-1/job/jellyfin.hcl index f6ddfc3..66ff29b 100644 --- a/nomad/regions/homelab-1/job/jellyfin.hcl +++ b/nomad/regions/homelab-1/job/jellyfin.hcl @@ -84,7 +84,7 @@ job "jellyfin" { driver = "docker" config { - image = "jellyfin/jellyfin@sha256:b4500b143d8a0d4383c50721517908d679af1c5ec00e791f0097f8c419b3e853" + image = "jellyfin/jellyfin@sha256:73501b70b0e884e5815d8f03d22973513ae7cadbcd8dba95da60e1d7c82dac7b" devices = [ { diff --git a/nomad/regions/homelab-1/main.tf b/nomad/regions/homelab-1/main.tf index 46699fc..7437c09 100644 --- a/nomad/regions/homelab-1/main.tf +++ b/nomad/regions/homelab-1/main.tf @@ -2,6 +2,10 @@ variable "flake_rev" { type = string } +variable "flake_ref" { + type = string +} + variable "flake_sha" { type = string } @@ -15,7 +19,7 @@ variable "flake_host_alt" { } provider "nomad" { - address = "http://10.64.1.201:4646" + address = "http://10.64.2.1:4646" region = "homelab-1" alias = "homelab-1" } diff --git a/nomad/regions/homelab-1/reicio.tf b/nomad/regions/homelab-1/reicio.tf index 2daa124..0fea1cf 100644 --- a/nomad/regions/homelab-1/reicio.tf +++ b/nomad/regions/homelab-1/reicio.tf @@ -4,7 +4,7 @@ resource "nomad_job" "reicio" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/syncthing.tf b/nomad/regions/homelab-1/syncthing.tf index c74a3c3..e34160e 100644 --- a/nomad/regions/homelab-1/syncthing.tf +++ b/nomad/regions/homelab-1/syncthing.tf @@ -73,7 +73,7 @@ resource "nomad_job" "syncthing" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/homelab-1/website.tf b/nomad/regions/homelab-1/website.tf index 473fbcc..c0c84d3 100644 --- a/nomad/regions/homelab-1/website.tf +++ b/nomad/regions/homelab-1/website.tf @@ -4,7 +4,7 @@ resource "nomad_job" "website" { hcl2 { enabled = true vars = { - flake_ref = "${var.flake_host}?rev=${var.flake_rev}" + flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}" flake_sha = var.flake_sha } } diff --git a/nomad/regions/main.tf b/nomad/regions/main.tf index e0e0761..06a9786 100644 --- a/nomad/regions/main.tf +++ b/nomad/regions/main.tf @@ -13,6 +13,10 @@ variable "flake_rev" { type = string } +variable "flake_ref" { + type = string +} + variable "flake_sha" { type = string } @@ -29,6 +33,7 @@ module "do-1" { source = "./do-1" flake_rev = var.flake_rev + flake_ref = var.flake_ref flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha @@ -42,6 +47,7 @@ module "homelab-1" { source = "./homelab-1" flake_rev = var.flake_rev + flake_ref = var.flake_ref flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha