diff --git a/defaults/main.yml b/defaults/main.yml index e157e2e..6d98ea3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,33 +33,29 @@ __slurm_config_default: ProctrackType: proctrack/pgid # slurmctld options SlurmctldPort: 6817 - SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else None }}" + SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else omit }}" SlurmctldPidFile: >- {{ - '/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else ( - '/var/run/slurmctld.pid' if __slurm_redhat else - None) + '/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else omit }} StateSaveLocation: >- {{ '/var/lib/slurm-llnl/slurmctld' if __slurm_debian else ( '/var/lib/slurm/slurmctld' if __slurm_redhat else - None) + omit) }} # slurmd options SlurmdPort: 6818 - SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else None }}" + SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else omit }}" SlurmdPidFile: >- {{ - '/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else ( - '/var/run/slurm.pid' if __slurm_redhat else - None) + '/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else omit }} SlurmdSpoolDir: >- {{ '/var/lib/slurm-llnl/slurmd' if __slurm_debian else ( '/var/spool/slurm/slurmd' if __slurm_redhat else - None) + omit) }} __slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}" @@ -83,9 +79,7 @@ __slurmdbd_config_default: SlurmUser: "{{ __slurm_user_name }}" PidFile: >- {{ - '/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else ( - '/var/run/slurmdbd.pid' if __slurm_redhat else - None) + '/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else omit }} - LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else None }}" + LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else omit }}" __slurmdbd_config_merged: "{{ __slurmdbd_config_default | combine(slurmdbd_config | default({})) }}" diff --git a/templates/generic.conf.j2 b/templates/generic.conf.j2 index 5a465de..c9815ee 100644 --- a/templates/generic.conf.j2 +++ b/templates/generic.conf.j2 @@ -4,7 +4,8 @@ {% set conf = lookup('vars', item.config) %} {% for key in conf | sort %} -{% if conf[key] != None %} -{{ key }}={{ conf[key] }} +{% set val = conf[key] %} +{% if val is not none and val != omit %} +{{ key }}={{ 'yes' if val is sameas true else ('no' if val is sameas false else val) }} {% endif %} {% endfor %} diff --git a/templates/slurm.conf.j2 b/templates/slurm.conf.j2 index e73fd4d..e1bc114 100644 --- a/templates/slurm.conf.j2 +++ b/templates/slurm.conf.j2 @@ -9,14 +9,15 @@ ControlMachine=localhost # Configuration options {% for key in __slurm_config_merged | sort %} -{% if __slurm_config_merged[key] %} -{{ key }}={{ __slurm_config_merged[key] }} +{% set val = __slurm_config_merged[key] %} +{% if val is not none and val != omit %} +{{ key }}={{ 'YES' if val is sameas true else ('NO' if val is sameas false else val) }} {% endif %} {% endfor %} # Nodes {% for i in slurm_nodes %} -NodeName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ i[k] }}{% endfor %} +NodeName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ 'YES' if i[k] is sameas true else ('NO' if i[k] is sameas false else i[k]) }}{% endfor %} {% else %} NodeName=localhost State=UNKNOWN @@ -24,7 +25,7 @@ NodeName=localhost State=UNKNOWN # Partitions {% for i in slurm_partitions %} -PartitionName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ i[k] }}{% endfor %} +PartitionName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ 'YES' if i[k] is sameas true else ('NO' if i[k] is sameas false else i[k]) }}{% endfor %} {% else %} PartitionName=debug Default=YES Nodes={{ (slurm_nodes[0] | default({})).name | default('localhost') }} State=UP