66 lines
1.2 KiB
Django/Jinja
66 lines
1.2 KiB
Django/Jinja
# {{ 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 %}
|