From 19f556995a863ff388af54eb570fa88fa300661f Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Thu, 17 Apr 2025 17:30:34 +0100 Subject: [PATCH 1/2] Fix openhpc_configless when set to false Need to pass this through the bool filter so that string values are interpreted as booleans. --- tasks/runtime.yml | 14 +++++++------- templates/slurm.conf.j2 | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tasks/runtime.yml b/tasks/runtime.yml index d947e5b..f281d24 100644 --- a/tasks/runtime.yml +++ b/tasks/runtime.yml @@ -84,7 +84,7 @@ ansible.builtin.tempfile: register: _slurm_conf_tmpfile delegate_to: localhost - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool changed_when: false # so molecule doesn't fail become: no @@ -95,7 +95,7 @@ lstrip_blocks: true mode: 0644 delegate_to: localhost - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool changed_when: false # so molecule doesn't fail become: no @@ -110,7 +110,7 @@ mode: 0644 loop: "{{ openhpc_config | dict2items }}" delegate_to: localhost - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool changed_when: false # so molecule doesn't fail become: no @@ -121,7 +121,7 @@ owner: root group: root mode: 0644 - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool notify: - Restart slurmctld service register: ohpc_slurm_conf @@ -134,7 +134,7 @@ mode: "0600" owner: slurm group: slurm - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool notify: - Restart slurmctld service register: ohpc_gres_conf @@ -148,7 +148,7 @@ mode: "0644" # perms/ownership based off src from ohpc package owner: root group: root - when: openhpc_enable.control | default(false) or not openhpc_slurm_configless + when: openhpc_enable.control | default(false) or not openhpc_slurm_configless | bool - name: Remove local tempfile for slurm.conf templating ansible.builtin.file: @@ -180,7 +180,7 @@ mode: 0644 when: - openhpc_enable.batch | default(false) - - openhpc_slurm_configless + - openhpc_slurm_configless | bool notify: - Restart slurmd service # Reloading is sufficent, but using a single handler means no bounce. Realistically this won't regularly change on a running slurmd so restarting is ok. diff --git a/templates/slurm.conf.j2 b/templates/slurm.conf.j2 index 67cc180..1761880 100644 --- a/templates/slurm.conf.j2 +++ b/templates/slurm.conf.j2 @@ -185,5 +185,5 @@ PartitionName={{part.name}} Default={{ part.get('default', 'YES') }} MaxTime={{ # Define a non-existent node, in no partition, so that slurmctld starts even with all partitions empty NodeName=nonesuch -{% if openhpc_slurm_configless %}SlurmctldParameters=enable_configless{% endif %} +{% if openhpc_slurm_configless | bool %}SlurmctldParameters=enable_configless{% endif %} ReturnToService=2 From 20b417cfec23ab6475d53b2ac2c17ff22666c4a7 Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Thu, 17 Apr 2025 17:31:47 +0100 Subject: [PATCH 2/2] Remove conf-server command line option if configless mode is disabled --- tasks/runtime.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/runtime.yml b/tasks/runtime.yml index f281d24..e7e48fe 100644 --- a/tasks/runtime.yml +++ b/tasks/runtime.yml @@ -169,10 +169,13 @@ notify: - Restart slurmd service -- name: Set slurmctld location for configless operation +- name: Configure slurmd command line options + vars: + slurmd_options_configless: "--conf-server {{ openhpc_slurm_control_host_address | default(openhpc_slurm_control_host) }}" + slurmd_options: "" lineinfile: path: /etc/sysconfig/slurmd - line: "SLURMD_OPTIONS='--conf-server {{ openhpc_slurm_control_host_address | default(openhpc_slurm_control_host) }}'" + line: "SLURMD_OPTIONS='{{ slurmd_options_configless if openhpc_slurm_configless | bool else slurmd_options }}'" regexp: "^SLURMD_OPTIONS=" create: yes owner: root @@ -180,7 +183,6 @@ mode: 0644 when: - openhpc_enable.batch | default(false) - - openhpc_slurm_configless | bool notify: - Restart slurmd service # Reloading is sufficent, but using a single handler means no bounce. Realistically this won't regularly change on a running slurmd so restarting is ok.