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
Copy file name to clipboardExpand all lines: ansible/roles/basic_users/README.md
+74-28Lines changed: 74 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,62 +7,108 @@ without requiring LDAP etc. Features:
7
7
- UID/GID is consistent across cluster (and explicitly defined).
8
8
- SSH key generated and propagated to all nodes to allow login between cluster nodes.
9
9
- An "external" SSH key can be added to allow login from elsewhere.
10
-
- Login to the control node is prevented (by default)
10
+
- Login to the control node is prevented (by default).
11
11
- When deleting users, systemd user sessions are terminated first.
12
12
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.
13
+
> [!IMPORTANT] This role assumes that `$HOME` for users managed by this role
14
+
(e.g. not `rocky` and other system users) is on a shared filesystem. The export
15
+
of this sharef filesystem may be root squashed if the server is in the
16
+
`basic_user` group - see configuration advice below.
18
17
19
18
Role Variables
20
19
--------------
21
20
22
21
-`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.
22
+
-`create_home` and `generate_ssh_key`: Normally set automatically. Can be
23
+
set `false` if necessary to disable home directory creation or cluster ssh
24
+
key creation, should not be set `true`.
25
+
-`ssh_key_comment`: Default is user name.
26
+
-`home`: Normally set automatically.
27
+
-`uid` should be set, so that the UID/GID is consistent across the cluster
28
+
(which Slurm requires).
29
+
-`shell` If *not* set will be `/sbin/nologin` on the `control` node and the
30
+
default shell on other users. Explicitly setting this defines the shell for
31
+
all nodes.
26
32
- An additional key `public_key` may optionally be specified to define a key to log into the cluster.
27
33
- An additional key `sudo` may optionally be specified giving a string (possibly multiline) defining sudo rules to be templated.
28
34
-`ssh_key_type` defaults to `ed25519` instead of the `ansible.builtin.user` default of `rsa`.
29
35
- Any other keys may present for other purposes (i.e. not used by this role).
30
36
-`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
37
-`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.
38
+
-`basic_users_homedir_host`: Optional inventory hostname. Host to run actions
39
+
which manipulate the home directories. If home directories are exported with
40
+
root squash, this *must* specify that server. If root squash is not used it
41
+
can be any node in the `basic_users` group. Default is the `control` node,
42
+
which assumes the default appliance NFS-exported home directory configuration.
43
+
-`basic_users_homedir_host_path`: Optional path prefix for home directories on
44
+
the `basic_users_homedir_host`. Default is `/exports/home` which assumes the
45
+
default appliance NFS-exported home directory configuration. **NB**: This may
46
+
vary depending on whether
47
+
`basic_users_homedir_host` is a server or a client for the home directories.
37
48
38
49
Dependencies
39
50
------------
40
51
41
52
None.
42
53
43
-
Example Playbook
44
-
----------------
54
+
Example Configurations
55
+
----------------------
45
56
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`:
57
+
With default appliance NFS configuration, create user `alice` with access
58
+
to all nodes except the control node, and delete user `bob`:
56
59
57
60
```yaml
58
61
basic_users_users:
59
62
- comment: Alice Aardvark
60
63
name: alice
61
64
uid: 2005
62
-
public_key: ssh-rsa ...
65
+
public_key: ssh-ed25519 ...
63
66
- comment: Bob Badger
64
67
name: bob
65
68
uid: 2006
66
-
public_key: ssh-rsa ...
69
+
public_key: ssh-ed25519 ...
67
70
state: absent
68
71
```
72
+
73
+
Using an external share which does not root squash so this role can create
74
+
directories on it, which is also mounted to the control node (so this role can
75
+
set authorized keys there), create user `Carol`:
76
+
77
+
```yaml
78
+
basic_users_homedir_host: "{{ ansible_play_hosts | first }}" # doesn't matter which host is used
79
+
basic_users_homedir_host_path: /home # homedir_host is client not server
80
+
basic_users_user:
81
+
- comment: Carol Crane
82
+
name: carol
83
+
uid: 2007
84
+
public_key: ssh-ed25519 ...
85
+
```
86
+
87
+
Using an external share which *does* root squash, so home directories cannot be
88
+
created by this role and must already exist, create user `Dan`:
89
+
90
+
```yaml
91
+
basic_users_homedir_host: "{{ ansible_play_hosts | first }}"
92
+
basic_users_homedir_host_path: /home
93
+
basic_users_users:
94
+
- comment: Dan Deer
95
+
create_home: false
96
+
name: dan
97
+
uuid: 2009
98
+
public_key: ssh-ed25519 ...
99
+
```
100
+
101
+
Using NFS exported from the control node, but mounted to all nodes (so that
102
+
authorized keys applies to all nodes), create user `Erin` with passwordless sudo:
103
+
104
+
```yaml
105
+
basic_users_users:
106
+
- comment: Erin Eagle
107
+
name: dan
108
+
uid: 2008
109
+
shell: /bin/bash # override default nologin on control
110
+
groups:
111
+
- adm # enables ssh to compute nodes even without a job running
0 commit comments