From 20f6d1b5d0bdfb28787b0b7ce3b30711437da7c3 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 20 Jul 2023 15:00:19 +0200 Subject: [PATCH] Update to 2023-07-20 15:00 --- roles/nomad/defaults/main.yml | 9 +++++++-- roles/nomad/templates/nomad.hcl.j2 | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/roles/nomad/defaults/main.yml b/roles/nomad/defaults/main.yml index b50cabb..37beed0 100644 --- a/roles/nomad/defaults/main.yml +++ b/roles/nomad/defaults/main.yml @@ -3,8 +3,8 @@ # List of plugins to install nomad_plugins: podman: - archive_url: https://releases.hashicorp.com/nomad-driver-podman/0.4.2/nomad-driver-podman_0.4.2_linux_amd64.zip - sha256: bdf7c9f70c79d3d3055e73fdc6212a9bfc221ed824451be2d07b2c62ce4267c4 + archive_url: https://releases.hashicorp.com/nomad-driver-podman/0.5.0/nomad-driver-podman_0.5.0_linux_amd64.zip + sha256: d5fd1a9e6a533c8a78b0f3c4f74f840c039a70a1e23cae216d1329016fd8b91a containerd: archive_url: https://github.com/Roblox/nomad-driver-containerd/releases/download/v0.9.4/containerd-driver sha256: 337e1bab178071500bfbe46a59946e0e3bafc652906ed1b755d2aa4d35990982 @@ -66,6 +66,11 @@ nomad_base_conf: # Node pool # node_pool: gateways + drain_on_shutdown: + deadline: 1h + force: False + ignore_system_jobs: False + # host_volumes: # - name: mysql # path: /data/mysql diff --git a/roles/nomad/templates/nomad.hcl.j2 b/roles/nomad/templates/nomad.hcl.j2 index 5b99f70..0050795 100644 --- a/roles/nomad/templates/nomad.hcl.j2 +++ b/roles/nomad/templates/nomad.hcl.j2 @@ -68,14 +68,30 @@ server { {% if nomad_conf.client.enabled %} client { enabled = true + servers = [ {% for server in nomad_servers %} "{{ server }}", {% endfor %} ] + {% if nomad_conf.client.node_pool is defined %} node_pool = "{{ nomad_conf.client.node_pool }}" {% endif %} + +{% if nomad_conf.client.drain_on_shutdown is defined %} + drain_on_shutdown { +{% if nomad_conf.client.drain_on_shutdown.deadline is defined %} + deadline = "{{ nomad_conf.client.drain_on_shutdown.deadline }}" +{% endif %} +{% for param in ['force', 'ignore_system_jobs'] %} +{% if nomad_conf.client.drain_on_shutdown[param] is defined %} + {{ param }} = {{ nomad_conf.client.drain_on_shutdown[param] | ternary('true', 'false') }} +{% endif %} +{% endfor %} + } +{% endif %} + {% for volume in nomad_conf.client.host_volumes %} host_volume "{{ volume.name }}" { path = "{{ volume.path }}"