From 151fca0b025f893494a61602d5a1d4dc6c96827e Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 24 Dec 2023 15:48:06 +0100 Subject: [PATCH] feat: add some variable for meta, node_class and node_pool --- defaults/main.yml | 8 ++++++++ templates/config.hcl.j2 | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index a4c22f0..80de496 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -26,3 +26,11 @@ nomad_plugins_podman: False nomad_docker_extra_labels: [] nomad_docker_allow_caps: [] nomad_client_network_interface: + +nomad_client_meta: [] +# - name: +# value: +# - name: +# value: +nomad_node_class: +nomad_node_pool: diff --git a/templates/config.hcl.j2 b/templates/config.hcl.j2 index 47312f1..8693de9 100644 --- a/templates/config.hcl.j2 +++ b/templates/config.hcl.j2 @@ -12,6 +12,21 @@ client { {% if nomad_client_network_interface %} network_interface = "{{ nomad_client_network_interface }}" {% endif %} +{% if nomad_client_meta %} + meta { + {% for meta in nomad_client_meta %} + {{meta["name"]}} = "{{meta["value"]}}" + {% endfor %} + + } +{% endif %} +{% if nomad_node_class %} + node_class = "{{nomad_node_class}}" +{% endif %} +{% if nomad_node_pool %} + node_pool = "{{nomad_node_pool}}" +{% endif %} + {% for nomad_host_volume in nomad_host_volumes %} host_volume "{{ nomad_host_volume['name'] }}" { path = "{{ nomad_host_volume['path'] }}"