You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* WIP: root squash nfs by default - fails b/c user homedir in wrong place
* WIP: run ALL userdir tasks on basic_users_homedir_host
* do ssh key handling on client node to simplify finding /home/rocky
* tidy basic_user defaults
* README/whitespace fixes
* fix ssh key location
* fix bash profile etc not existing
* make ssh key comment match docs
* make export location definition clear
* fix hpctests to work with root-squashed /home
* Non-functional suggestions from code review
Co-authored-by: Scott Davidson <[email protected]>
* address wording comments from PR
---------
Co-authored-by: Scott Davidson <[email protected]>
Copy file name to clipboardExpand all lines: ansible/roles/basic_users/README.md
+82-29Lines changed: 82 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -5,64 +5,117 @@ basic_users
5
5
Setup users on cluster nodes using `/etc/passwd` and manipulating `$HOME`, i.e.
6
6
without requiring LDAP etc. Features:
7
7
- UID/GID is consistent across cluster (and explicitly defined).
8
-
- SSH key generated and propagated to all nodes to allow login between cluster nodes.
8
+
- SSH key generated and propagated to all nodes to allow login between cluster
9
+
nodes.
9
10
- An "external" SSH key can be added to allow login from elsewhere.
10
-
- Login to the control node is prevented (by default)
11
+
- Login to the control node is prevented (by default).
11
12
- When deleting users, systemd user sessions are terminated first.
12
13
13
-
Requirements
14
-
------------
15
-
-`$HOME` (for normal users, i.e. not `rocky`) is assumed to be on a shared
16
-
filesystem. Actions affecting that shared filesystem are run on a single host,
17
-
see `basic_users_manage_homedir` below.
14
+
> [!IMPORTANT] This role assumes that `$HOME` for users managed by this role
15
+
(e.g. not `rocky` and other system users) is on a shared filesystem. The export
16
+
of this shared filesystem may be root squashed if its server is in the
17
+
`basic_user` group - see configuration examples below.
18
18
19
19
Role Variables
20
20
--------------
21
21
22
22
-`basic_users_users`: Optional, default empty list. A list of mappings defining information for each user. In general, mapping keys/values are passed through as parameters to [ansible.builtin.user](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html) and default values are as given there. However:
23
-
-`create_home`, `generate_ssh_key` and `ssh_key_comment` are set automatically; this assumes home directories are on a cluster-shared filesystem.
24
-
-`uid` should be set, so that the UID/GID is consistent across the cluster (which Slurm requires).
25
-
-`shell` if *not* set will be `/sbin/nologin` on the `control` node and the default shell on other users. Explicitly setting this defines the shell for all nodes.
23
+
-`create_home` and `generate_ssh_key`: Normally set automatically. Can be
24
+
set `false` if necessary to disable home directory creation/cluster ssh
25
+
key creation. Should not be set `true` to avoid trying to modify home
26
+
directories from multiple nodes simultaneously.
27
+
-`ssh_key_comment`: Default is user name.
28
+
-`home`: Set automatically based on the user name and
29
+
`basic_users_homedir_host_path`. Can be overriden if required for e.g.
30
+
users with non-standard home directory paths.
31
+
-`uid`: Should be set, so that the UID/GID is consistent across the cluster
32
+
(which Slurm requires).
33
+
-`shell`: If *not* set will be `/sbin/nologin` on the `control` node to
34
+
prevent users logging in to this node, and the default shell on other
35
+
nodes. Explicitly setting this defines the shell for all nodes and if the
36
+
shared home directories are mounted on the control node will allow the
37
+
user to log in to the control node.
26
38
- An additional key `public_key` may optionally be specified to define a key to log into the cluster.
27
39
- An additional key `sudo` may optionally be specified giving a string (possibly multiline) defining sudo rules to be templated.
28
40
-`ssh_key_type` defaults to `ed25519` instead of the `ansible.builtin.user` default of `rsa`.
29
41
- Any other keys may present for other purposes (i.e. not used by this role).
30
42
-`basic_users_groups`: Optional, default empty list. A list of mappings defining information for each group. Mapping keys/values are passed through as parameters to [ansible.builtin.group](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/group_module.html) and default values are as given there.
31
43
-`basic_users_override_sssd`: Optional bool, default false. Whether to disable `sssd` when ensuring users/groups exist with this role. Permits creating local users/groups even if they clash with users provided via sssd (e.g. from LDAP). Ignored if host is not in group `sssd` as well. Note with this option active `sssd` will be stopped and restarted each time this role is run.
32
-
-`basic_users_manage_homedir`: Optional bool, must be true on a single host to
33
-
determine which host runs tasks affecting the shared filesystem. The default
34
-
is to use the first play host which is not the control node, because the
35
-
default NFS configuration does not have the shared `/home` directory mounted
36
-
on the control node.
44
+
-`basic_users_homedir_host`: Optional inventory hostname defining the host
45
+
to use to create home directories. If the home directory export is root
46
+
squashed, this host *must* be the home directory server. Default is the
47
+
`control` node which is appropriate for the default appliance configuration.
48
+
Not relevant if `create_home` is false for all users.
49
+
-`basic_users_homedir_host_path`: Optional path prefix for home directories on
50
+
the `basic_users_homedir_host`, i.e. on the "server side". Default is
51
+
`/exports/home` which is appropriate for the default appliance configuration.
37
52
38
53
Dependencies
39
54
------------
40
55
41
56
None.
42
57
43
-
Example Playbook
44
-
----------------
58
+
Example Configurations
59
+
----------------------
45
60
46
-
```yaml
47
-
- hosts: basic_users
48
-
become: yes
49
-
gather_facts: yes
50
-
tasks:
51
-
- import_role:
52
-
name: basic_users
53
-
```
54
-
55
-
Example variables, to create user `alice` and delete user `bob`:
61
+
With default appliance NFS configuration, create user `alice` with access
62
+
to all nodes except the control node, and delete user `bob`:
56
63
57
64
```yaml
58
65
basic_users_users:
59
66
- comment: Alice Aardvark
60
67
name: alice
61
68
uid: 2005
62
-
public_key: ssh-rsa ...
69
+
public_key: ssh-ed25519 ...
63
70
- comment: Bob Badger
64
71
name: bob
65
72
uid: 2006
66
-
public_key: ssh-rsa ...
73
+
public_key: ssh-ed25519 ...
67
74
state: absent
68
75
```
76
+
77
+
Using an external share which:
78
+
- does not root squash (so this role can create directories on it)
79
+
- is mounted to all nodes including the control node (so this role can set
80
+
authorized keys there)
81
+
82
+
Create user `Carol`:
83
+
84
+
```yaml
85
+
basic_users_homedir_host: "{{ ansible_play_hosts | first }}" # doesn't matter which host is used
86
+
basic_users_homedir_host_path: /home # homedir_host is client not server
87
+
basic_users_user:
88
+
- comment: Carol Crane
89
+
name: carol
90
+
uid: 2007
91
+
public_key: ssh-ed25519 ...
92
+
```
93
+
94
+
Using an external share which *does* root squash, so home directories cannot be
95
+
created by this role and must already exist, create user `Dan`:
96
+
97
+
```yaml
98
+
basic_users_homedir_host: "{{ ansible_play_hosts | first }}"
99
+
basic_users_homedir_host_path: /home
100
+
basic_users_users:
101
+
- comment: Dan Deer
102
+
create_home: false
103
+
name: dan
104
+
uuid: 2008
105
+
public_key: ssh-ed25519 ...
106
+
```
107
+
108
+
Using NFS exported from the control node, but mounted to all nodes (so that
109
+
authorized keys applies to all nodes), create user `Erin` with passwordless sudo:
110
+
111
+
```yaml
112
+
basic_users_users:
113
+
- comment: Erin Eagle
114
+
name: erin
115
+
uid: 2009
116
+
shell: /bin/bash # override default nologin on control
117
+
groups:
118
+
- adm # enables ssh to compute nodes even without a job running
Copy file name to clipboardExpand all lines: ansible/roles/hpctests/README.md
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,10 @@ Requirements
22
22
23
23
Role Variables
24
24
--------------
25
-
26
-
-`hpctests_rootdir`: Required. Path to root of test directory tree, which must be on a r/w filesystem shared to all cluster nodes under test. The last directory component will be created.
25
+
-`hpctests_user`: Optional. User to run jobs as. Default is `ansible_user`.
26
+
-`hpctests_rootdir`: Optional. Path to root of test directory tree. This must
27
+
be a r/w filesystem shared to all cluster nodes under test. Default is
28
+
`/home/{{ hpctests_user }}/hpctests`. **NB:** Do not use `~` in this path.
27
29
-`hpctests_partition`: Optional. Name of partition to use, otherwise default partition is used.
28
30
-`hpctests_nodes`: Optional. A Slurm node expression, e.g. `'compute-[0-15,19]'` defining the nodes to use. If not set all nodes in the selected partition are used.
29
31
-`hpctests_ucx_net_devices`: Optional. Control which network device/interface to use, e.g. `mlx5_1:0`. The default of `all` (as per UCX) may not be appropriate for multi-rail nodes with different bandwidths on each device. See [here](https://openucx.readthedocs.io/en/master/faq.html#what-is-the-default-behavior-in-a-multi-rail-environment) and [here](https://github.com/openucx/ucx/wiki/UCX-environment-parameters#setting-the-devices-to-use). Alternatively a mapping of partition name (as `hpctests_partition`) to device/interface can be used. For partitions not defined in the mapping the default of `all` is used.
0 commit comments