mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 16:04:25 +01:00
2c832617b6
Signed-off-by: Magic_RB <magic_rb@redalder.org>
143 lines
3.2 KiB
HCL
143 lines
3.2 KiB
HCL
resource "nomad_volume" "home-assistant_hass" {
|
|
type = "csi"
|
|
plugin_id = "org.democratic-csi.nfs"
|
|
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 = {
|
|
server = "blowhole.hosts.in.redalder.org"
|
|
share = "/var/nfs/home-assistant_hass"
|
|
node_attach_driver = "nfs"
|
|
provisioner_driver = "node-manual"
|
|
}
|
|
|
|
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"
|
|
}
|
|
|
|
mount_options {
|
|
fs_type = "nfs"
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
|
}
|
|
}
|
|
|
|
resource "nomad_volume" "home-assistant_zigbee2mqtt" {
|
|
type = "csi"
|
|
plugin_id = "org.democratic-csi.nfs"
|
|
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 = {
|
|
server = "blowhole.hosts.in.redalder.org"
|
|
share = "/var/nfs/home-assistant_zigbee2mqtt"
|
|
node_attach_driver = "nfs"
|
|
provisioner_driver = "node-manual"
|
|
}
|
|
|
|
mount_options {
|
|
fs_type = "nfs"
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
|
}
|
|
}
|
|
|
|
resource "nomad_volume" "home-assistant_mosquitto" {
|
|
type = "csi"
|
|
plugin_id = "org.democratic-csi.nfs"
|
|
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 = {
|
|
server = "blowhole.hosts.in.redalder.org"
|
|
share = "/var/nfs/home-assistant_mosquitto"
|
|
node_attach_driver = "nfs"
|
|
provisioner_driver = "node-manual"
|
|
}
|
|
|
|
mount_options {
|
|
fs_type = "nfs"
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
|
}
|
|
}
|
|
|
|
resource "vault_policy" "home-assistant-policy" {
|
|
name = "home-assistant-policy"
|
|
policy = <<EOF
|
|
path "kv/data/cluster/home-assistant" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "vault_policy" "zigbee2mqtt-policy" {
|
|
name = "zigbee2mqtt-policy"
|
|
policy = <<EOF
|
|
path "kv/data/cluster/mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
|
|
path "kv/data/cluster/zigbee2mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "vault_policy" "mosquitto-policy" {
|
|
name = "mosquitto-policy"
|
|
policy = <<EOF
|
|
path "kv/data/cluster/mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOF
|
|
}
|
|
|
|
resource "nomad_job" "home-assistant" {
|
|
jobspec = file("${path.module}/job/home-assistant.hcl")
|
|
|
|
hcl2 {
|
|
enabled = true
|
|
vars = {
|
|
flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}"
|
|
flake_sha = var.flake_sha
|
|
}
|
|
}
|
|
}
|