2022-06-01 08:41:51 +02:00
|
|
|
resource "vault_policy" "dovecot-policy" {
|
|
|
|
name = "dovecot-policy"
|
2022-07-30 23:27:40 +02:00
|
|
|
policy = <<EOF
|
2022-10-27 11:26:19 +02:00
|
|
|
path "kv/data/dovecot" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
EOF
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "vault_policy" "getmail-policy" {
|
|
|
|
name = "getmail-policy"
|
2022-07-30 23:27:40 +02:00
|
|
|
policy = <<EOF
|
2022-10-27 11:26:19 +02:00
|
|
|
path "kv/data/getmail" {
|
2022-07-30 23:27:40 +02:00
|
|
|
capabilities = ["read"]
|
|
|
|
}
|
|
|
|
EOF
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_volume" "dovecot_maildir" {
|
|
|
|
type = "csi"
|
2022-10-27 11:26:19 +02:00
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
2022-06-01 08:41:51 +02:00
|
|
|
volume_id = "dovecot_maildir"
|
|
|
|
name = "dovecot_maildir"
|
|
|
|
external_id = "dovecot_maildir"
|
|
|
|
|
|
|
|
capability {
|
2022-10-27 11:26:19 +02:00
|
|
|
access_mode = "multi-node-multi-writer"
|
2022-06-01 08:41:51 +02:00
|
|
|
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/dovecot/maildir"
|
2022-10-27 11:26:19 +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:26:19 +02:00
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_volume" "getmail_getmail-d" {
|
|
|
|
type = "csi"
|
2022-10-27 11:26:19 +02:00
|
|
|
plugin_id = "org.democratic-csi.nfs"
|
2022-06-01 08:41:51 +02:00
|
|
|
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 = {
|
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/getmail/getmail.d"
|
2022-10-27 11:26:19 +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:26:19 +02:00
|
|
|
mount_flags = [ "nfsvers=3", "hard", "async" ]
|
2022-06-01 08:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_job" "email" {
|
2022-07-30 23:27:40 +02:00
|
|
|
jobspec = file("${path.module}/job/email.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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|