Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a parameter to allow a specific group to access compute nodes without having jobs on the node #350

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The `profile::` sections list the available classes, their role and their parame
- [`profile::rsyslog::client`](#profilersyslogclient)
- [`profile::rsyslog::server`](#profilersyslogserver)
- [`profile::slurm::base`](#profileslurmbase)
- [`profile::slurm::node`](#profileslurmnode)
- [`profile::slurm::accounting`](#profileslurmaccounting)
- [`profile::slurm::controller`](#profileslurmcontroller)
- [`profile::software_stack`](#profilesoftware_stack)
Expand Down Expand Up @@ -974,6 +975,22 @@ When `profile::slurm::base` is included, these classes are included too:
- [`profile::consul`](#profileconsul)
- [`profile::base::powertools`](#profilebasepowertools)

## `profile::slurm::node`
This class allows some configuration for the Slurm compute nodes.

### parameters
| Variable | Description | Type |
| :---------------------- | :------------------------------------------------------ | :----- |
| `pam_access_group` | Group that can access the node regardless of Slurm jobs | String |

<details>
<summary>default values</summary>

```yaml
profile::slurm::node::pam_access_group: undef
```
</details>


## `profile::slurm::accounting`

Expand Down
15 changes: 12 additions & 3 deletions site/profile/manifests/slurm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,9 @@
}

# Slurm node class. This is where slurmd is ran.
class profile::slurm::node {
class profile::slurm::node (
String $pam_access_group = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make this an array instead, we can get rid of the if/else:

Array[String] $pam_acccess_groups = ['wheel']

) {
contain profile::slurm::base

$slurm_version = lookup('profile::slurm::base::slurm_version')
Expand Down Expand Up @@ -622,13 +624,20 @@
require => Pam['Add pam_slurm_adopt']
}

$access_conf = '
if $pam_access_group and $pam_access_group != '' {
$access_conf_addon = "+:${pam_access_group}:ALL"
}
else {
$access_conf_addon = ''
}
$access_conf = "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$access_conf = @(END)
# Allow root cronjob
+ : root : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
# Allow other groups if any
<% for $pam_access_groups.each | $group | { %->
+:<%= $group %>:ALL
<% } -%>
-:ALL:ALL
END

# Allow root cronjob
+ : root : cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
# Allow admin to connect, deny all other
+:wheel:ALL
${access_conf_addon}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then access.conf becomes

  file { '/etc/security/access.conf':
    ensure  => present,
    content => inline_template($access_conf, { 'pam_access_groups' => $pam_access_groups }),
  }

-:ALL:ALL
'
"

file { '/etc/security/access.conf':
ensure => present,
Expand Down
Loading