Sort parts of the nomad intra into folders
This should make finding things easier
This commit is contained in:
54
2-nomad-config/1-data.tf
Normal file
54
2-nomad-config/1-data.tf
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
module "data" {
|
||||
source = "./1-data"
|
||||
}
|
||||
|
||||
data "nomad_plugin" "smb" {
|
||||
plugin_id = "smb"
|
||||
wait_for_healthy = true
|
||||
}
|
||||
|
||||
provider "postgresql" {
|
||||
host = "jaglan-beta-m21.lan"
|
||||
port = 5432
|
||||
database = "postgres"
|
||||
username = "postgres"
|
||||
password = data.sops_file.secrets.data["postgres.postgres"]
|
||||
sslmode = "disable"
|
||||
connect_timeout = 15
|
||||
}
|
||||
|
||||
# csi-smb.tf
|
||||
|
||||
moved {
|
||||
from = nomad_job.csi-smb
|
||||
to = module.data.nomad_job.csi-smb
|
||||
}
|
||||
|
||||
# postgres.tf
|
||||
|
||||
moved {
|
||||
from = nomad_job.postgres
|
||||
to = module.data.nomad_job.postgres
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_job.pgadmin
|
||||
to = module.data.nomad_job.pgadmin
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_job.pgbackup
|
||||
to = module.data.nomad_job.pgbackup
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_variable.postgres
|
||||
to = module.data.nomad_variable.postgres
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_csi_volume_registration.unraid_database_dump
|
||||
to = module.data.nomad_csi_volume_registration.unraid_database_dump
|
||||
}
|
||||
|
||||
5
2-nomad-config/1-data/csi-smb.tf
Normal file
5
2-nomad-config/1-data/csi-smb.tf
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
resource "nomad_job" "csi-smb" {
|
||||
jobspec = file("${path.module}/csi-smb.nomad.hcl")
|
||||
}
|
||||
|
||||
25
2-nomad-config/1-data/main.tf
Normal file
25
2-nomad-config/1-data/main.tf
Normal file
@@ -0,0 +1,25 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
sops = {
|
||||
source = "carlpett/sops"
|
||||
version = "~> 0.5"
|
||||
}
|
||||
postgresql = {
|
||||
source = "cyrilgdn/postgresql"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "nomad" {
|
||||
address = "http://jaglan-beta-m20.lan:4646"
|
||||
}
|
||||
|
||||
data "sops_file" "secrets" {
|
||||
source_file = "secrets/secrets.enc.json"
|
||||
}
|
||||
|
||||
data "nomad_plugin" "smb" {
|
||||
plugin_id = "smb"
|
||||
wait_for_healthy = true
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
resource "nomad_job" "postgres" {
|
||||
jobspec = file("postgres.nomad.hcl")
|
||||
jobspec = file("${path.module}/postgres.nomad.hcl")
|
||||
rerun_if_dead = true
|
||||
}
|
||||
|
||||
resource "nomad_job" "pgadmin" {
|
||||
jobspec = file("pgadmin.nomad.hcl")
|
||||
jobspec = file("${path.module}/pgadmin.nomad.hcl")
|
||||
}
|
||||
|
||||
resource "nomad_job" "pgbackup" {
|
||||
jobspec = file("pgbackup.nomad.hcl")
|
||||
jobspec = file("${path.module}/pgbackup.nomad.hcl")
|
||||
}
|
||||
|
||||
resource "nomad_variable" "postgres" {
|
||||
@@ -18,16 +18,6 @@ resource "nomad_variable" "postgres" {
|
||||
}
|
||||
}
|
||||
|
||||
provider "postgresql" {
|
||||
host = "jaglan-beta-m21.lan"
|
||||
port = 5432
|
||||
database = "postgres"
|
||||
username = "postgres"
|
||||
password = data.sops_file.secrets.data["postgres.postgres"]
|
||||
sslmode = "disable"
|
||||
connect_timeout = 15
|
||||
}
|
||||
|
||||
resource "nomad_csi_volume_registration" "unraid_database_dump" {
|
||||
#Note: Before chaning the definition of this volume you need to stop the jobs that are using it
|
||||
depends_on = [data.nomad_plugin.smb]
|
||||
54
2-nomad-config/2-ingress.tf
Normal file
54
2-nomad-config/2-ingress.tf
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
module "ingress" {
|
||||
source = "./2-ingress"
|
||||
}
|
||||
|
||||
# traefik.tf
|
||||
|
||||
moved {
|
||||
from = cloudflare_dns_record.othrayte-one
|
||||
to = module.ingress.cloudflare_dns_record.othrayte-one
|
||||
}
|
||||
|
||||
moved {
|
||||
from = cloudflare_dns_record.star-othrayte-one
|
||||
to = module.ingress.cloudflare_dns_record.star-othrayte-one
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_variable.traefik
|
||||
to = module.ingress.nomad_variable.traefik
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_job.traefik
|
||||
to = module.ingress.nomad_job.traefik
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_csi_volume_registration.unraid_appdata_traefik
|
||||
to = module.ingress.nomad_csi_volume_registration.unraid_appdata_traefik
|
||||
}
|
||||
|
||||
# authelia.tf
|
||||
|
||||
moved {
|
||||
from = nomad_job.authelia
|
||||
to = module.ingress.nomad_job.authelia
|
||||
}
|
||||
|
||||
moved {
|
||||
from = postgresql_role.authelia
|
||||
to = module.ingress.postgresql_role.authelia
|
||||
}
|
||||
|
||||
moved {
|
||||
from = postgresql_database.authelia
|
||||
to = module.ingress.postgresql_database.authelia
|
||||
}
|
||||
|
||||
moved {
|
||||
from = nomad_variable.authelia
|
||||
to = module.ingress.nomad_variable.authelia
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
resource "nomad_job" "authelia" {
|
||||
jobspec = file("authelia.nomad.hcl")
|
||||
jobspec = file("${path.module}/authelia.nomad.hcl")
|
||||
}
|
||||
|
||||
resource "postgresql_role" "authelia" {
|
||||
33
2-nomad-config/2-ingress/main.tf
Normal file
33
2-nomad-config/2-ingress/main.tf
Normal file
@@ -0,0 +1,33 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
sops = {
|
||||
source = "carlpett/sops"
|
||||
version = "~> 0.5"
|
||||
}
|
||||
cloudflare = {
|
||||
source = "cloudflare/cloudflare"
|
||||
version = "~> 5"
|
||||
}
|
||||
postgresql = {
|
||||
source = "cyrilgdn/postgresql"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "nomad" {
|
||||
address = "http://jaglan-beta-m20.lan:4646"
|
||||
}
|
||||
|
||||
data "sops_file" "secrets" {
|
||||
source_file = "secrets/secrets.enc.json"
|
||||
}
|
||||
|
||||
provider "cloudflare" {
|
||||
api_token = data.sops_file.secrets.data["cloudflare.api_token"]
|
||||
}
|
||||
|
||||
data "nomad_plugin" "smb" {
|
||||
plugin_id = "smb"
|
||||
wait_for_healthy = true
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ resource "nomad_variable" "traefik" {
|
||||
}
|
||||
|
||||
resource "nomad_job" "traefik" {
|
||||
jobspec = templatefile("traefik.nomad.hcl", {
|
||||
jobspec = templatefile("${path.module}/traefik.nomad.hcl", {
|
||||
hass_magic_token = nonsensitive(data.sops_file.secrets.data["hass.magic-token"])
|
||||
})
|
||||
}
|
||||
@@ -32,15 +32,6 @@ provider "cloudflare" {
|
||||
api_token = data.sops_file.secrets.data["cloudflare.api_token"]
|
||||
}
|
||||
|
||||
resource "nomad_job" "csi-smb" {
|
||||
jobspec = file("csi-smb.nomad.hcl")
|
||||
}
|
||||
|
||||
data "nomad_plugin" "smb" {
|
||||
plugin_id = "smb"
|
||||
wait_for_healthy = true
|
||||
}
|
||||
|
||||
resource "nomad_scheduler_config" "config" {
|
||||
memory_oversubscription_enabled = true
|
||||
preemption_config = {
|
||||
@@ -51,4 +42,3 @@ resource "nomad_scheduler_config" "config" {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user