|
1 | 1 | # Slurm base class that is included in each different profile. |
2 | | -# The class configures the slurm and munge users, install the |
| 2 | +# The class configures the slurm user, install the |
3 | 3 | # base slurm packages and configures everything that is required |
4 | 4 | # on all types of nodes. |
5 | 5 | # @param cluster_name Specifies the name of the cluster as it appears in slurm.conf |
6 | | -# @param munge_key Specifies the munge secret key that allows slurm nodes to communicate |
| 6 | +# @param auth_key Specifies the auth secret key that allows slurm nodes to communicate |
7 | 7 | # @param slurm_version Specifies which version of Slurm to install |
8 | 8 | # @param os_reserved_memory Specifies the amount of memory reserved for the operating system in compute node |
9 | 9 | class profile::slurm::base ( |
10 | 10 | String $cluster_name, |
11 | | - String $munge_key, |
| 11 | + String $auth_key, |
12 | 12 | Enum['24.05', '24.11', '25.05', '25.11'] $slurm_version, |
13 | 13 | Integer $os_reserved_memory, |
14 | 14 | Integer $suspend_time = 3600, |
|
39 | 39 | before => Package['slurm'] |
40 | 40 | } |
41 | 41 |
|
42 | | - group { 'munge': |
43 | | - ensure => 'present', |
44 | | - gid => '2002' |
45 | | - } |
46 | | - |
47 | | - user { 'munge': |
48 | | - ensure => 'present', |
49 | | - groups => 'munge', |
50 | | - uid => '2002', |
51 | | - home => '/var/lib/munge', |
52 | | - comment => 'MUNGE Uid N Gid Emporium', |
53 | | - shell => '/sbin/nologin', |
54 | | - before => Package['munge'] |
55 | | - } |
56 | | - |
57 | 42 | package { 'xauth': |
58 | 43 | ensure => 'installed', |
59 | 44 | } |
60 | 45 |
|
61 | | - package { 'munge': |
62 | | - ensure => 'installed', |
63 | | - } |
64 | | - |
65 | | - # Sometime /var/run/munge is not created. |
66 | | - # Munge RPM provides /usr/lib/tmpfiles.d/munge.conf |
67 | | - # tmpfiles.d config was replaced with RuntimeDirectory as of munge 0.5.14 |
68 | | - # but we are stuck with 0.5.13 as upstream has not updated munge |
69 | | - # since 2021. The next 2 file_lines make sure munge does not rely on |
70 | | - # systemd-tmpfiles-setup.service. |
71 | | - # Ref: https://github.com/dun/munge/commit/3eed37e3ca73c14b679394df7be151d27566b0fe |
72 | | - # Ref: https://github.com/dun/munge/issues/75 |
73 | | - file_line { 'munge_runtimedirectory': |
74 | | - path => '/usr/lib/systemd/system/munge.service', |
75 | | - match => '^RuntimeDirectory=', |
76 | | - line => 'RuntimeDirectory=munge', |
77 | | - after => 'Group=munge', |
78 | | - require => Package['munge'], |
79 | | - notify => Service['munge'], |
80 | | - } |
81 | | - |
82 | | - file_line { 'munge_runtimedirectorymode': |
83 | | - path => '/usr/lib/systemd/system/munge.service', |
84 | | - match => '^RuntimeDirectoryMode=', |
85 | | - line => 'RuntimeDirectoryMode=0755', |
86 | | - after => 'Group=munge', |
87 | | - require => Package['munge'], |
88 | | - notify => Service['munge'], |
89 | | - } |
90 | | - |
91 | | - # Fix a warning in systemctl status munge about the location of the PID file. |
92 | | - file_line { 'munge_pidfile': |
93 | | - path => '/usr/lib/systemd/system/munge.service', |
94 | | - match => '^PIDFile=', |
95 | | - line => 'PIDFile=/run/munge/munged.pid', |
96 | | - require => Package['munge'], |
97 | | - notify => Service['munge'], |
98 | | - } |
99 | | - |
100 | 46 | file { '/var/log/slurm': |
101 | 47 | ensure => 'directory', |
102 | 48 | owner => 'slurm', |
|
116 | 62 | seltype => 'usr_t' |
117 | 63 | } |
118 | 64 |
|
119 | | - file { '/etc/munge': |
120 | | - ensure => 'directory', |
121 | | - owner => 'munge', |
122 | | - group => 'munge' |
123 | | - } |
124 | | - |
125 | 65 | file { '/etc/slurm/cgroup.conf': |
126 | 66 | ensure => 'present', |
127 | 67 | owner => 'slurm', |
|
155 | 95 | content => $slurm_path, |
156 | 96 | } |
157 | 97 |
|
158 | | - file { '/etc/munge/munge.key': |
| 98 | + file { '/etc/slurm/slurm.key': |
159 | 99 | ensure => 'present', |
160 | | - owner => 'munge', |
161 | | - group => 'munge', |
162 | | - mode => '0400', |
163 | | - content => $munge_key, |
164 | | - before => Service['munge'] |
165 | | - } |
166 | | - |
167 | | - service { 'munge': |
168 | | - ensure => 'running', |
169 | | - enable => true, |
170 | | - subscribe => File['/etc/munge/munge.key'], |
171 | | - require => Package['munge'] |
| 100 | + owner => 'slurm', |
| 101 | + group => 'slurm', |
| 102 | + mode => '0600', |
| 103 | + content => $auth_key, |
| 104 | + require => [ |
| 105 | + File['/etc/slurm'], |
| 106 | + ] |
172 | 107 | } |
173 | 108 |
|
174 | 109 | $yumrepo_prefix = "https://download.copr.fedorainfracloud.org/results/cmdntrf/Slurm${slurm_version}/" |
|
187 | 122 | name => "slurm-${slurm_version}*", |
188 | 123 | require => [ |
189 | 124 | Exec['enable_powertools'], |
190 | | - Package['munge'], |
191 | 125 | Yumrepo['slurm-copr-repo'], |
192 | 126 | Yumrepo['epel'], |
193 | 127 | ], |
|
197 | 131 | ensure => 'installed', |
198 | 132 | require => [ |
199 | 133 | Package['slurm'], |
200 | | - Package['munge'], |
201 | 134 | Yumrepo['slurm-copr-repo']], |
202 | 135 | } |
203 | 136 |
|
|
211 | 144 | ensure => 'installed', |
212 | 145 | require => [ |
213 | 146 | Package['slurm'], |
214 | | - Package['munge'], |
215 | 147 | Yumrepo['slurm-copr-repo'] |
216 | 148 | ], |
217 | 149 | } |
|
261 | 193 | require => File['/etc/slurm'], |
262 | 194 | } |
263 | 195 |
|
264 | | - # SELinux policy required to allow confined users to submit job with Slurm 19, 20, 21. |
265 | | - # Slurm commands tries to write to a socket in /var/run/munge. |
266 | | - # Confined users cannot stat this file, neither write to it. The policy |
267 | | - # allows user_t to getattr and write var_run_t sock file. |
268 | | - # To get the policy, we had to disable dontaudit rules with : sudo semanage -DB |
269 | | - selinux::module { 'munge_socket': |
270 | | - ensure => 'present', |
271 | | - source_pp => 'puppet:///modules/profile/slurm/munge_socket.pp', |
272 | | - } |
273 | | - |
274 | 196 | file {'/etc/slurm/nodes.conf': |
275 | 197 | ensure => 'present', |
276 | 198 | owner => 'slurm', |
|
325 | 247 | name => "slurm-slurmdbd-${slurm_version}*", |
326 | 248 | require => [ |
327 | 249 | Package['slurm'], |
328 | | - Package['munge'], |
329 | 250 | Yumrepo['slurm-copr-repo'] |
330 | 251 | ], |
331 | 252 | } |
|
338 | 259 | File['/etc/slurm/slurmdbd.conf'], |
339 | 260 | ], |
340 | 261 | subscribe => [ |
| 262 | + File['/etc/slurm/slurm.key'], |
341 | 263 | Mysql::Db['slurm_acct_db'], |
342 | 264 | ], |
343 | 265 | before => Service['slurmctld'] |
|
515 | 437 | package { 'slurm-slurmctld': |
516 | 438 | ensure => 'installed', |
517 | 439 | require => [ |
518 | | - Package['munge'], |
519 | 440 | Package['slurm'], |
520 | 441 | ], |
521 | 442 | } |
|
531 | 452 | File['/etc/slurm/slurm-addendum.conf'], |
532 | 453 | File['/etc/slurm/gres.conf'], |
533 | 454 | File['/etc/slurm/nodes.conf'], |
| 455 | + File['/etc/slurm/slurm.key'], |
534 | 456 | ] |
535 | 457 | } |
536 | 458 |
|
|
757 | 679 | File['/etc/slurm/slurm.conf'], |
758 | 680 | File['/etc/slurm/slurm-addendum.conf'], |
759 | 681 | File['/etc/slurm/nodes.conf'], |
| 682 | + File['/etc/slurm/slurm.key'], |
760 | 683 | ], |
761 | 684 | require => [ |
762 | 685 | Package['slurm-slurmd'], |
|
799 | 722 | # controller through Slurm command-line tools. |
800 | 723 | class profile::slurm::submitter { |
801 | 724 | contain profile::slurm::base |
| 725 | + package { 'slurm-sackd': |
| 726 | + require => Yumrepo['slurm-copr-repo'] |
| 727 | + } |
| 728 | + service { 'sackd': |
| 729 | + ensure => running, |
| 730 | + enable => true, |
| 731 | + subscribe => [ |
| 732 | + File['/etc/slurm/slurm.key'], |
| 733 | + ] |
| 734 | + require => [ |
| 735 | + Package['slurm-sackd'], |
| 736 | + ], |
| 737 | + } |
802 | 738 | } |
0 commit comments