Fixes, works with just roles set, need to test actually configuring

stuff
This commit is contained in:
Nate Coraor 2019-01-29 22:35:28 -05:00
parent cd7135bf91
commit 3aa56e1699
8 changed files with 36 additions and 29 deletions

View File

@ -19,7 +19,7 @@ slurmdbd_service_name: slurmdbd
__slurm_user_name: "{{ (slurm_user | default({})).name | default('slurm') }}"
# TODO: this could be incorrect, use the group collection from galaxyproject.galaxy
__slurm_group_name: "{{ (slurm_user | default({})).group | default((slurm_user | default({})).name) | default('slurm') }}"
__slurm_group_name: "{{ (slurm_user | default({})).group | default(omit) }}"
__slurm_debian: "{{ ansible_os_family == 'Debian' }}"
__slurm_redhat: "{{ ansible_os_family == 'RedHat' }}"
@ -29,35 +29,37 @@ __slurm_config_default:
CryptoType: crypto/munge
SlurmUser: "{{ __slurm_user_name }}"
ClusterName: cluster
# default is proctrack/cgroup which is the best but also less than 100% chance of working e.g. in docker
ProctrackType: proctrack/pgid
# slurmctld options
SlurmctldPort: 6817
SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else null }}"
SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else None }}"
SlurmctldPidFile: >-
{{
'/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else (
'/var/run/slurmctld.pid' if __slurm_redhat else
null)
None)
}}
StateSaveLocation: >-
{{
'/var/lib/slurm-llnl/slurmctld' if __slurm_debian else (
'/var/lib/slurm/slurmctld' if __slurm_redhat else
null)
None)
}}
# slurmd options
SlurmdPort: 6818
SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else null }}"
SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else None }}"
SlurmdPidFile: >-
{{
'/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else (
'/var/run/slurm.pid' if __slurm_redhat else
null)
None)
}}
SlurmdSpoolDir: >-
{{
'/var/lib/slurm-llnl/slurmd' if __slurm_debian else (
'/var/spool/slurm/slurmd' if __slurm_redhat else
null)
None)
}}
__slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}"
@ -83,7 +85,7 @@ __slurmdbd_config_default:
{{
'/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else (
'/var/run/slurmdbd.pid' if __slurm_redhat else
null)
None)
}}
LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else null }}"
LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else None }}"
__slurmdbd_config_merged: "{{ __slurmdbd_config_default | combine(slurmdbd_config | default({})) }}"

View File

@ -2,7 +2,7 @@
- name: Include user creation tasks
include_tasks: user.yml
when: slurm_user is defined
when: slurm_create_user
- name: Include controller installation tasks
include_tasks: slurmctld.yml

View File

@ -10,12 +10,12 @@
- name: Install munge key
copy:
src: "{{ slurm_munge_key_src }}"
src: "{{ slurm_munge_key }}"
dest: /etc/munge/munge.key
owner: munge
group: munge
mode: 0400
when: slurm_munge_key_src is defined
when: slurm_munge_key is defined
- name: Ensure Munge is enabled and running
service:

View File

@ -23,4 +23,4 @@
group: "{{ __slurm_group_name }}"
mode: 0755
state: directory
when: slurm_create_dirs and __slurm_config_merged.SlurmctldLogFile != None
when: slurm_create_dirs and __slurm_config_merged.SlurmctldLogFile

View File

@ -23,7 +23,7 @@
group: "{{ __slurm_group_name }}"
mode: 0755
state: directory
when: slurm_create_dirs and __slurm_config_merged.SlurmdLogFile != None
when: slurm_create_dirs and __slurm_config_merged.SlurmdLogFile
- name: Include config dir creation tasks
include_tasks: _inc_create_config_dir.yml

View File

@ -22,4 +22,4 @@
group: "{{ __slurm_group_name }}"
mode: 0755
state: directory
when: slurm_create_dirs and __slurmdbd_config_merged.LogFile != None
when: slurm_create_dirs and __slurmdbd_config_merged.LogFile

View File

@ -2,17 +2,18 @@
- name: Create slurm group
group:
name: "{{ slurm_user.name | default('slurm') }}"
gid: "{{ slurm_user.gid | default(omit) }}"
system: "{{ slurm_user.system | default('yes') }}"
name: "{{ (slurm_user | default({})).group }}"
gid: "{{ (slurm_user | default({})).gid | default(omit) }}"
system: "{{ (slurm_user | default({})).system | default('yes') }}"
when: (slurm_user | default({})).group is defined
- name: Create slurm user
user:
name: "{{ slurm_user.name | default('slurm') }}"
comment: "{{ slurm_user.comment | default(omit) }}"
uid: "{{ slurm_user.uid | default(omit) }}"
group: "{{ slurm_user.group | default(slurm_user.name | default('slurm')) }}"
groups: "{{ slurm_user.groups | default(omit) }}"
home: "{{ slurm_user.home | default(omit) }}"
shell: "{{ slurm_user.shell | default(omit) }}"
system: "{{ slurm_user.system | default('yes') }}"
name: "{{ (slurm_user | default({})).name | default('slurm') }}"
comment: "{{ (slurm_user | default({})).comment | default(omit) }}"
uid: "{{ (slurm_user | default({})).uid | default(omit) }}"
group: "{{ (slurm_user | default({})).group | default(omit) }}"
groups: "{{ (slurm_user | default({})).groups | default(omit) }}"
home: "{{ (slurm_user | default({})).home | default(omit) }}"
shell: "{{ (slurm_user | default({})).shell | default(omit) }}"
system: "{{ (slurm_user | default({})).system | default('yes') }}"

View File

@ -9,18 +9,22 @@ ControlMachine=localhost
# Configuration options
{% for key in __slurm_config_merged | sort %}
{% if __slurm_config_merged[key] != None %}
{% if __slurm_config_merged[key] %}
{{ key }}={{ __slurm_config_merged[key] }}
{% endif %}
{% endfor %}
# Nodes
{% for i in slurm_nodes %}
NodeName={{ i.name }}{% for k in i %} {{ k }}={{ i[k] }}{% endfor %}
NodeName={{ i.name }}{% for k in i | sort %} {{ k }}={{ i[k] }}{% endfor %}
{% else %}
NodeName=localhost State=UNKNOWN
{% endfor %}
# Partitions
{% for i in slurm_partitions %}
PartitionName={{ i.name }}{% for k in i %} {{ k }}={{ i[k] }}{% endfor %}
PartitionName={{ i.name }}{% for k in i | sort %} {{ k }}={{ i[k] }}{% endfor %}
{% else %}
PartitionName=debug Default=YES Nodes={{ slurm_nodes[0] | default('localhost') }} State=UP
{% endfor %}