cluster/nomad/regions/homelab-1/email.tf
main 1b51d5ae56 General clean up and a switch back to Docker
Signed-off-by: main <magic_rb@redalder.org>
2022-10-27 11:43:27 +02:00

80 lines
1.7 KiB
HCL

resource "vault_policy" "dovecot-policy" {
name = "dovecot-policy"
policy = <<EOF
path "kv/data/dovecot" {
capabilities = ["read"]
}
EOF
}
resource "vault_policy" "getmail-policy" {
name = "getmail-policy"
policy = <<EOF
path "kv/data/getmail" {
capabilities = ["read"]
}
EOF
}
resource "nomad_volume" "dovecot_maildir" {
type = "csi"
plugin_id = "org.democratic-csi.nfs"
volume_id = "dovecot_maildir"
name = "dovecot_maildir"
external_id = "dovecot_maildir"
capability {
access_mode = "multi-node-multi-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.hosts.in.redalder.org"
share = "/var/nfs/dovecot/maildir"
node_attach_driver = "nfs"
provisioner_driver = "node-manual"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nfsvers=3", "hard", "async" ]
}
}
resource "nomad_volume" "getmail_getmail-d" {
type = "csi"
plugin_id = "org.democratic-csi.nfs"
volume_id = "getmail_getmail-d"
name = "getmail_getmail-d"
external_id = "getmail_getmail-d"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.hosts.in.redalder.org"
share = "/var/nfs/getmail/getmail.d"
node_attach_driver = "nfs"
provisioner_driver = "node-manual"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nfsvers=3", "hard", "async" ]
}
}
resource "nomad_job" "email" {
jobspec = file("${path.module}/job/email.hcl")
hcl2 {
enabled = true
vars = {
flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}"
flake_sha = var.flake_sha
}
}
}