2022-06-01 08:41:51 +02:00
|
|
|
resource "nomad_volume" "home-assistant_hass" {
|
|
|
|
type = "csi"
|
2022-10-27 11:38:38 +02:00
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
2022-06-01 08:41:51 +02:00
|
|
|
volume_id = "home-assistant_hass"
|
|
|
|
name = "home-assistant_hass"
|
|
|
|
external_id = "home-assistant_hass"
|
|
|
|
|
|
|
|
capability {
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
}
|
|
|
|
|
|
|
|
context = {
|
2022-07-30 23:27:40 +02:00
|
|
|
server = "blowhole.hosts.in.redalder.org"
|
2022-06-01 08:41:51 +02:00
|
|
|
share = "/var/nfs/home-assistant_hass"
|
2022-10-27 11:38:38 +02:00
|
|
|
node_attach_driver = "nfs"
|
|
|
|
provisioner_driver = "node-manual"
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
2022-10-27 11:26:19 +02:00
|
|
|
mount_options {
|
|
|
|
fs_type = "nfs"
|
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_volume" "home-assistant_db" {
|
|
|
|
type = "csi"
|
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
|
|
|
volume_id = "home-assistant_db"
|
|
|
|
name = "home-assistant_db"
|
|
|
|
external_id = "home-assistant_db"
|
|
|
|
|
|
|
|
capability {
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
}
|
|
|
|
|
|
|
|
context = {
|
|
|
|
server = "blowhole.hosts.in.redalder.org"
|
|
|
|
share = "/var/nfs/home-assistant_db"
|
|
|
|
node_attach_driver = "nfs"
|
|
|
|
provisioner_driver = "node-manual"
|
|
|
|
}
|
|
|
|
|
2022-06-01 08:41:51 +02:00
|
|
|
mount_options {
|
|
|
|
fs_type = "nfs"
|
2022-10-27 11:38:38 +02:00
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_volume" "home-assistant_zigbee2mqtt" {
|
|
|
|
type = "csi"
|
2022-10-27 11:38:38 +02:00
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
2022-06-01 08:41:51 +02:00
|
|
|
volume_id = "home-assistant_zigbee2mqtt"
|
|
|
|
name = "home-assistant_zigbee2mqtt"
|
|
|
|
external_id = "home-assistant_zigbee2mqtt"
|
|
|
|
|
|
|
|
capability {
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
}
|
|
|
|
|
|
|
|
context = {
|
2022-07-30 23:27:40 +02:00
|
|
|
server = "blowhole.hosts.in.redalder.org"
|
2022-06-01 08:41:51 +02:00
|
|
|
share = "/var/nfs/home-assistant_zigbee2mqtt"
|
2022-10-27 11:38:38 +02:00
|
|
|
node_attach_driver = "nfs"
|
|
|
|
provisioner_driver = "node-manual"
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mount_options {
|
|
|
|
fs_type = "nfs"
|
2022-10-27 11:38:38 +02:00
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_volume" "home-assistant_mosquitto" {
|
|
|
|
type = "csi"
|
2022-10-27 11:38:38 +02:00
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
2022-06-01 08:41:51 +02:00
|
|
|
volume_id = "home-assistant_mosquitto"
|
|
|
|
name = "home-assistant_mosquitto"
|
|
|
|
external_id = "home-assistant_mosquitto"
|
|
|
|
|
|
|
|
capability {
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
}
|
|
|
|
|
|
|
|
context = {
|
2022-07-30 23:27:40 +02:00
|
|
|
server = "blowhole.hosts.in.redalder.org"
|
2022-06-01 08:41:51 +02:00
|
|
|
share = "/var/nfs/home-assistant_mosquitto"
|
2022-10-27 11:38:38 +02:00
|
|
|
node_attach_driver = "nfs"
|
|
|
|
provisioner_driver = "node-manual"
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mount_options {
|
|
|
|
fs_type = "nfs"
|
2022-10-27 11:38:38 +02:00
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "vault_policy" "home-assistant-policy" {
|
|
|
|
name = "home-assistant-policy"
|
2022-07-30 23:27:40 +02:00
|
|
|
policy = <<EOF
|
2023-04-23 22:54:54 +02:00
|
|
|
path "kv/data/cluster/home-assistant" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
EOF
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "vault_policy" "zigbee2mqtt-policy" {
|
|
|
|
name = "zigbee2mqtt-policy"
|
2022-07-30 23:27:40 +02:00
|
|
|
policy = <<EOF
|
2023-04-23 22:54:54 +02:00
|
|
|
path "kv/data/cluster/mqtt" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
|
2023-04-23 22:54:54 +02:00
|
|
|
path "kv/data/cluster/zigbee2mqtt" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
EOF
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "vault_policy" "mosquitto-policy" {
|
|
|
|
name = "mosquitto-policy"
|
2022-07-30 23:27:40 +02:00
|
|
|
policy = <<EOF
|
2023-04-23 22:54:54 +02:00
|
|
|
path "kv/data/cluster/mqtt" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
EOF
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_job" "home-assistant" {
|
2022-07-30 23:27:40 +02:00
|
|
|
jobspec = file("${path.module}/job/home-assistant.hcl")
|
2022-06-01 08:41:51 +02:00
|
|
|
|
|
|
|
hcl2 {
|
|
|
|
enabled = true
|
|
|
|
vars = {
|
2022-08-26 20:51:11 +02:00
|
|
|
flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}"
|
2022-06-01 08:41:51 +02:00
|
|
|
flake_sha = var.flake_sha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|