homelab/nomad-job/backup-vault.nomad

54 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-11-01 17:58:42 +00:00
2023-11-25 17:57:32 +00:00
job "backup-vault" {
2023-11-01 17:58:42 +00:00
datacenters = ["homelab"]
priority = 50
type = "batch"
meta {
forcedeploy = "0"
}
2024-02-21 18:02:08 +00:00
constraint {
attribute = "${node.class}"
operator = "set_contains"
value = "cluster"
}
2023-11-01 17:58:42 +00:00
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
periodic {
crons = ["30 3 * * *"]
prohibit_overlap = true
}
2023-11-25 17:57:32 +00:00
group "backup-vault" {
2023-11-01 17:58:42 +00:00
network {
mode = "host"
}
vault {
policies = ["vault-backup"]
}
2023-11-25 17:57:32 +00:00
task "backup-vault" {
2023-11-01 17:58:42 +00:00
driver = "docker"
config {
2024-03-17 17:58:24 +00:00
image = "docker.service.consul:5000/ducampsv/docker-vault-backup:latest"
2023-11-01 17:58:42 +00:00
volumes = [
2024-02-21 18:02:08 +00:00
"/mnt/diskstation/nomad/backup/vault:/backup"
2023-11-01 17:58:42 +00:00
]
}
template {
data = <<EOH
{{ with secret "secrets/data/nomad/vault-backup"}}
VAULT_APPROLEID = "{{ .Data.data.VAULT_APPROLEID }}"
VAULT_SECRETID = "{{ .Data.data.VAULT_SECRETID }}"
{{end}}
EOH
destination = "secrets/secrets.env"
env = true
}
resources {
memory = 100
}
}
}
}