Skip to content

Commit

Permalink
Merge pull request #5 from Slugger70/slurmdbd-cluster
Browse files Browse the repository at this point in the history
Added cluster creation to slurmdb install
  • Loading branch information
natefoo committed Jul 16, 2023
2 parents 9442d48 + 9f268c4 commit cb26443
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ slurmd_service_name: slurmd
slurmctld_service_name: slurmctld
slurmdbd_service_name: slurmdbd

#Cluster name for slurm config. This is required to correctly setup slurmdbd and attune it to the slurm config.
__slurm_cluster_name: cluster
__cluster_not_setup: true #Default value. Is modified if cluster already exists.

slurm_start_services: true

__slurm_user_name: "{{ (slurm_user | default({})).name | default('slurm') }}"
Expand All @@ -42,7 +46,7 @@ __slurm_config_default:
AuthType: auth/munge
CryptoType: crypto/munge
SlurmUser: "{{ __slurm_user_name }}"
ClusterName: cluster
ClusterName: "{{ __slurm_cluster_name }}"
# 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
Expand Down
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
enabled: true
state: started
when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)"

- name: Setup cluster on slurmdb
include_tasks: slurmdbd_cluster.yml
when: "slurm_start_services and ('slurmdbdservers' in group_names or 'dbd' in slurm_roles)"
20 changes: 20 additions & 0 deletions tasks/slurmdbd_cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

- name: Check for existence of cluster in db.
register: cluster_check
shell: "sacctmgr -n list cluster | cut -f 4 -d ' '"
become: yes
become_user: root

- name: set cluster_check_boolean
set_fact:
__cluster_not_setup: false
when: cluster_check.stdout == "cluster"

- name: Create the slurmdbd cluster
command: sacctmgr -i -n add cluster {{ __slurm_cluster_name }}
become: yes
become_user: root
notify:
- reload slurmdbd
when: __cluster_not_setup

0 comments on commit cb26443

Please sign in to comment.