homelab/nomad-job/backup-vault.nomad

50 lines
1019 B
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"
}
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 {
image = "ducampsv/docker-vault-backup:latest"
volumes = [
"/mnt/diskstation/git/backup/vault:/backup"
]
}
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
}
}
}
}