From 38c9cbd45adc6d3a87efaf94d97ebad0c6a62946 Mon Sep 17 00:00:00 2001 From: Bruce Becker Date: Sat, 12 Nov 2022 07:49:31 +0100 Subject: [PATCH] feat(consul): add job to snapshot consul (#13) Signed-off-by: Bruce Becker Signed-off-by: Bruce Becker --- consul-snapshot.nomad | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 consul-snapshot.nomad diff --git a/consul-snapshot.nomad b/consul-snapshot.nomad new file mode 100644 index 0000000..58eee64 --- /dev/null +++ b/consul-snapshot.nomad @@ -0,0 +1,39 @@ +job "consul-backup" { + datacenters = ["dc1"] + type = "batch" + periodic { + cron = "1-59/5 * * * * *" + } + group "data" { + count = 1 + network {} + volume "scratch" { + type = "host" + source = "scratch" + read_only = false + } + task "get-terraform" { + driver = "exec" + lifecycle { + hook = "prestart" + sidecar = false + } + config { + command = "bash" + args = ["-c", "curl https://releases.hashicorp.com/terraform/1.3.4/terraform_1.3.4_linux_arm64.zip | gunzip ->terraform ; chmod u+x terraform"] + } + volume_mount { + volume = "scratch" + destination = "/volume" + read_only = false + } + } + task "check-consul" { + driver = "exec" + config { + command = "bash" + args = ["-c", "consul -version"] + } + } + } +}