Update backup job config to iterate over job files

This will prevent new ones from being added and not included
This commit is contained in:
IamTheFij 2023-08-03 10:33:11 -07:00
parent 0a5480129e
commit df5ed00f05

View File

@ -112,54 +112,14 @@ RCLONE_FTP_NO_CHECK_CERTIFICATE=true
data = <<EOF data = <<EOF
# Current node is {{ env "node.unique.name" }} {{ env "node.unique.id" }} # Current node is {{ env "node.unique.name" }} {{ env "node.unique.id" }}
{{ range nomadService "grafana" -}} %{~ for job_file in fileset(module_path, "jobs/*.hcl") }
# grafana .Node {{ .Node }} {{ range nomadService "${trimsuffix(basename(job_file), ".hcl")}" -}}
# ${trimsuffix(basename(job_file), ".hcl")} .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}} {{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/grafana.hcl")} ${file("${module_path}/${job_file}")}
{{- end }}
{{- end }}
{{ range nomadService "lidarr" -}}
# lidarr .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/lidarr.hcl")}
{{- end }}
{{- end }}
{{ range nomadService "lldap" -}}
# lldap .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/lldap.hcl")}
{{- end }}
{{- end }}
{{ range nomadService "nzbget" -}}
# nzbget .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/nzbget.hcl")}
{{- end }}
{{- end }}
{{ range nomadService "photoprism" -}}
# photoprism .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/photoprism.hcl")}
{{- end }}
{{- end }}
{{ range nomadService "sabnzbd" -}}
# sabnzbd .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/sabnzbd.hcl")}
{{- end }}
{{- end }}
{{ range nomadService "sonarr" -}}
# sonarr .Node {{ .Node }}
{{ if eq .Node (env "node.unique.id") -}}
${file("${module_path}/jobs/sonarr.hcl")}
{{- end }} {{- end }}
{{- end }} {{- end }}
%{ endfor ~}
EOF EOF
destination = "local/node-jobs.hcl" destination = "local/node-jobs.hcl"
} }