diff --git a/defaults/main.yml b/defaults/main.yml index f6648b6..70c2a9c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,3 +36,8 @@ nomad_client_host_networks: [] nomad_client_max_kill_timeout: 5m nomad_docker_auth_enabled: false nomad_docker_auth_file: /root/.docker/config.json + +nomad_batch_scheduler_enabled: true +nomad_scheduler_enabled: true +nomad_service_scheduler_enabled: true +nomad_sysbatch_scheduler_enabled: true diff --git a/tasks/assert.yml b/tasks/assert.yml index db3eff0..d6fe5aa 100644 --- a/tasks/assert.yml +++ b/tasks/assert.yml @@ -107,6 +107,34 @@ - nomad_client is boolean quiet: true +- name: assert | Test if nomad_sysbatch_scheduler_enabled is set correctly + ansible.builtin.assert: + that: + - nomad_sysbatch_scheduler_enabled is defined + - nomad_sysbatch_scheduler_enabled is boolean + quiet: true + +- name: assert | Test if nomad_service_scheduler_enabled is set correctly + ansible.builtin.assert: + that: + - nomad_service_scheduler_enabled is defined + - nomad_service_scheduler_enabled is boolean + quiet: true + +- name: assert | Test if nomad_scheduler_enabled is set correctly + ansible.builtin.assert: + that: + - nomad_scheduler_enabled is defined + - nomad_scheduler_enabled is boolean + quiet: true + +- name: assert | Test if nomad_batch_scheduler_enabled is set correctly + ansible.builtin.assert: + that: + - nomad_batch_scheduler_enabled is defined + - nomad_batch_scheduler_enabled is boolean + quiet: true + - name: assert | Test if nomad_client_node_class is set correctly ansible.builtin.assert: that: diff --git a/templates/server.hcl.j2 b/templates/server.hcl.j2 index e75b19b..0c4575e 100644 --- a/templates/server.hcl.j2 +++ b/templates/server.hcl.j2 @@ -3,4 +3,13 @@ server { enabled = true bootstrap_expect = {{ nomad_server_bootstrap_expect }} + + default_scheduler_config { + preemption_config { + batch_scheduler_enabled = {{ nomad_batch_scheduler_enabled }} + system_scheduler_enabled = {{ nomad_scheduler_enabled }} + service_scheduler_enabled = {{ nomad_service_scheduler_enabled }} + sysbatch_scheduler_enabled = {{ nomad_sysbatch_scheduler_enabled }} + } + } }