Skip to content

Commit 339f195

Browse files
committed
fix basic_users not modifying default nfs-shared home correctly
1 parent d474a4f commit 339f195

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

ansible/roles/basic_users/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
basic_users
33
===========
44

5-
Setup users on cluster nodes using `/etc/passwd` and manipulating `$HOME`, i.e. without requiring LDAP etc. Features:
5+
Setup users on cluster nodes using `/etc/passwd` and manipulating `$HOME`, i.e.
6+
without requiring LDAP etc. Features:
67
- UID/GID is consistent across cluster (and explicitly defined).
78
- SSH key generated and propagated to all nodes to allow login between cluster nodes.
89
- An "external" SSH key can be added to allow login from elsewhere.
9-
- Login to the control node is prevented.
10+
- Login to the control node is prevented (by default)
1011
- When deleting users, systemd user sessions are terminated first.
1112

1213
Requirements
1314
------------
14-
- $HOME (for normal users, i.e. not `centos`) is assumed to be on a shared filesystem.
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.
1518

1619
Role Variables
1720
--------------
@@ -25,6 +28,11 @@ Role Variables
2528
- Any other keys may present for other purposes (i.e. not used by this role).
2629
- `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.
2730
- `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.
31+
- `basic_users_manage_homedir`: Optional bool, must be true on a single host to
32+
determine which host runs tasks affecting the shared filesystem. The default
33+
is to use the first play host which is not the control node, because the
34+
default NFS configuration does not have the shared `/home` directory mounted
35+
on the control node.
2836

2937
Dependencies
3038
------------

ansible/roles/basic_users/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
basic_users_manage_homedir: "{{ (ansible_hostname == (ansible_play_hosts | first)) }}"
1+
basic_users_manage_homedir: "{{ ansible_hostname == (ansible_play_hosts | difference(groups['control']) | first) }}"
22
basic_users_userdefaults:
33
state: present
44
create_home: "{{ basic_users_manage_homedir }}"

ansible/roles/basic_users/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
- item.state | default('present') == 'present'
4747
- item.public_key is defined
4848
- basic_users_manage_homedir
49-
run_once: true
5049

5150
- name: Write generated public key as authorized for SSH access
5251
authorized_key:

0 commit comments

Comments
 (0)