Skip to content

Commit

Permalink
chore: update file permissions and paths for Slurm configuration file…
Browse files Browse the repository at this point in the history
…s and directories.
  • Loading branch information
viniciusdc committed Mar 7, 2024
1 parent cb28bc0 commit d1fe0df
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/kvm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
- name: Check hosts
run: |
cat /etc/hosts
- name: Kill any process that helds the lock
run: |
sudo killall apt apt-get
- name: Extract Network Information
run: |
Expand Down
2 changes: 2 additions & 0 deletions roles/slurm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ slurmd_enabled: false
slurmctld_enabled: false
slurmdbd_enabled: false

SlurmConfigFileDIr: /etc/slurm-llnl

slurm_config:
ClusterName: cluster
# slurmctld options
Expand Down
8 changes: 4 additions & 4 deletions roles/slurm/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- name: Ensure that slurm configuration directory exists
become: true
ansible.builtin.file:
path: /etc/slurm
path: "{{ SlurmConfigFileDIr }}"
state: directory
mode: "0755"
owner: root
Expand All @@ -26,10 +26,10 @@
become: true
ansible.builtin.template:
src: templates/slurm.conf
dest: /etc/slurm/slurm.conf
dest: "{{ SlurmConfigFileDIr }}/slurm.conf"
owner: root
group: root
mode: "0444"
mode: "0755"
register: _slurm_config

- name: Install extra execution host configs
Expand All @@ -40,7 +40,7 @@
ConstrainCores=yes
ConstrainRAMSpace=yes
ConstrainSwapSpace=yes
dest: /etc/slurm/cgroup.conf
dest: "{{ SlurmConfigFileDIr }}/cgroup.conf"
owner: root
group: root
mode: "0444"
Expand Down
1 change: 1 addition & 0 deletions roles/slurm/tasks/slurm_exporter.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: Install golang
ansible.builtin.include_tasks: golang.yaml

- name: Check that the slurm exporter binary exists
ansible.builtin.stat:
path: /usr/local/bin/prometheus_slurm_exporter
Expand Down
12 changes: 9 additions & 3 deletions roles/slurm/tasks/slurmctld.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
---
# Must be writable by user SlurmUser.
# The file must be accessible by the primary and backup control machines.
- name: Ensure slurm state directory exists
become: true
ansible.builtin.file:
path: "{{ slurm_config.StateSaveLocation }}"
state: directory
mode: "0700"
mode: "0755"
owner: slurm
group: slurm

# Must be writable by user SlurmUser.
# The file must be accessible by the primary and backup control machines.
- name: Ensure slurm log directory exists
become: true
ansible.builtin.file:
path: "{{ slurm_config.SlurmctldLogFile | dirname }}"
state: directory
mode: "0700"
mode: "0755"
owner: slurm
group: slurm

# Must be writable by user root. Preferably writable and removable by SlurmUser.
# The file must be accessible by the primary and backup control machines.
- name: Ensure slurm pid directory exists
become: true
ansible.builtin.file:
Expand All @@ -33,7 +39,7 @@
[Unit]
Description=Slurm controller daemon
After=network.target munge.service
ConditionPathExists=/etc/slurm/slurm.conf
ConditionPathExists={{ SlurmConfigFileDIr }}/slurm.conf
[Service]
Type=forking
Expand Down
8 changes: 7 additions & 1 deletion roles/slurm/tasks/slurmd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
# Permissions must be set to 755 so that job scripts can be executed from this directory.
# A distinct file must exist on each compute node.
- name: Create slurm spool directory
become: true
ansible.builtin.file:
Expand All @@ -8,6 +10,8 @@
mode: "0755"
state: directory

# Must be writable by user root.
# A distinct file must exist on each compute node.
- name: Create slurm log directory
become: true
ansible.builtin.file:
Expand All @@ -17,6 +21,8 @@
mode: "0755"
state: directory

# Must be writable by user root.
# A distinct file must exist on each compute node.
- name: Ensure slurm pid directory exists
become: true
ansible.builtin.file:
Expand All @@ -33,7 +39,7 @@
[Unit]
Description=Slurm node daemon
After=network.target munge.service remote-fs.target
ConditionPathExists=/etc/slurm/slurm.conf
ConditionPathExists={{ SlurmConfigFileDIr }}/slurm.conf
[Service]
Type=forking
Expand Down
12 changes: 9 additions & 3 deletions roles/slurm/tasks/slurmdbd.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
# Must be writable by user SlurmUser.
- name: Ensure slurmdbd log directory exists
become: true
ansible.builtin.file:
path: "{{ slurmdbd_config.LogFile | dirname }}"
state: directory
mode: "0700"
mode: "0755"
owner: slurm
group: slurm

# Must be writable by user SlurmUser.
- name: Ensure slurm pid directory exists
become: true
ansible.builtin.file:
Expand All @@ -17,11 +19,15 @@
owner: slurm
group: slurm

# This file should be only on the computer where SlurmDBD executes
# and should only be readable by the user which executes SlurmDBD (e.g. "slurm").
# This file should be protected from unauthorized access since
# it contains a database password
- name: Install slurmdbd.conf
become: true
ansible.builtin.template:
src: templates/slurmdbd.conf
dest: /etc/slurm/slurmdbd.conf
dest: "{{ SlurmConfigFileDIr }}/slurmdbd.conf"
owner: slurm
group: slurm
mode: "0600"
Expand All @@ -34,7 +40,7 @@
[Unit]
Description=Slurm DBD accounting daemon
After=network.target munge.service
ConditionPathExists=/etc/slurm/slurmdbd.conf
ConditionPathExists={{ SlurmConfigFileDIr }}/slurmdbd.conf
[Service]
Type=forking
Expand Down

0 comments on commit d1fe0df

Please sign in to comment.