Skip to content

Commit 791c3e4

Browse files
committed
refactor(conf): systemd DynamicUser for slurmrestd
Instead of creating system user and group for slurmrestd, rely of systemd DynamicUser feature to create the user dynamically when the service starts.
1 parent 34f0914 commit 791c3e4

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

conf/roles/slurm/tasks/server.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,6 @@
3939
state: latest
4040
when: slurm_with_accounting
4141

42-
# Create slurmrestd system user/group to run slurmrestd with unprivileged user
43-
# when using TCP/IP socket (ie. not unix socket).
44-
- name: Create slurmrestd system group
45-
ansible.builtin.group:
46-
name: slurmrestd
47-
gid: "{{ slurmrestd_gid }}"
48-
when: slurm_with_jwt
49-
50-
- name: Create slurmrest system user
51-
ansible.builtin.user:
52-
name: slurmrestd
53-
uid: "{{ slurmrestd_uid }}"
54-
group: slurmrestd
55-
system: yes
56-
shell: /sbin/nologin
57-
home: /var/spool/slurmrest
58-
create_home: no
59-
when: slurm_with_jwt
60-
6142
- name: Install slurmrestd
6243
ansible.builtin.package:
6344
name: "{{ slurm_emulator | ternary(slurm_emulator_server_packages, slurm_restd_packages) }}"

conf/roles/slurm/templates/slurmrestd.service.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ RuntimeDirectoryMode=0755
1616
ExecStart=/usr/sbin/slurmrestd $SLURMRESTD_OPTIONS {% if not slurm_with_accounting %}-s openapi/slurmctld {% endif %}-a {% if slurm_with_jwt %}rest_auth/jwt{% else %}rest_auth/local{% endif %} [::]:{{ slurm_restd_port }}
1717
{% endif %}
1818
{% if slurm_with_jwt %}
19+
DynamicUser=yes
1920
User=slurmrestd
2021
Group=slurmrestd
2122
{% else %}

0 commit comments

Comments
 (0)