From 39ebd7571b31d75e1bd17878e0cc1741b20212e5 Mon Sep 17 00:00:00 2001 From: jeremy Date: Wed, 4 Feb 2026 10:00:34 -0600 Subject: [PATCH] Add Nomad templates --- roles/nomad/templates/client.hcl.j2 | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 roles/nomad/templates/client.hcl.j2 diff --git a/roles/nomad/templates/client.hcl.j2 b/roles/nomad/templates/client.hcl.j2 new file mode 100644 index 0000000..252cb2c --- /dev/null +++ b/roles/nomad/templates/client.hcl.j2 @@ -0,0 +1,65 @@ +# {{ ansible_managed }} +# Nomad Client Configuration + +client { + enabled = true + +{% if nomad_node_class != "" %} + node_class = "{{ nomad_node_class }}" +{% endif %} + +{% if nomad_meta | length > 0 %} + meta { +{% for key, value in nomad_meta.items() %} + "{{ key }}" = "{{ value }}" +{% endfor %} + } +{% endif %} + +{% for volume in nomad_host_volumes %} + host_volume "{{ volume.name }}" { + path = "{{ volume.path }}" + read_only = {{ volume.read_only | default(false) | lower }} + } +{% endfor %} + + # Reserved resources for system + reserved { + cpu = 500 + memory = 512 + } +} + +# Plugin configurations +plugin "docker" { + config { + enabled = {{ nomad_driver_docker | lower }} + + # Allow privileged containers + allow_privileged = true + + # GPU support (if available) + # allow_caps = ["ALL"] + + volumes { + enabled = true + } + + # Extra labels for containers + extra_labels = ["job_name", "task_group_name", "task_name", "namespace", "node_name"] + } +} + +plugin "raw_exec" { + config { + enabled = {{ nomad_driver_raw_exec | lower }} + } +} + +{% if nomad_driver_qemu %} +plugin "qemu" { + config { + image_paths = ["/var/lib/nomad/qemu/images"] + } +} +{% endif %}