feat(user_management): add the user_management role
Copied from the environment repository's local role. The files are identical except: galaxy namespace mortis; comments and the README scrubbed of environment references (issue numbers, playbooks, inventory groups and group_vars paths, the provisioning roles by name, the history of the variable rename), with the technical explanation kept; the README asks for the role by its FQCN, names the run order generically (after the step that creates the guest, before mortis.kamino.sshd) and its example play uses mortis.kamino.user_management; the molecule scenario calls the role by its FQCN, follows the Kamino scenario conventions (kamino-molecule header, scenario.test_sequence) and no longer sets ANSIBLE_COLLECTIONS_PATH or ANSIBLE_ROLES_PATH. No variable, default, argument_specs entry or task logic changed: the key-only root fallback, the handback and user_management_lock_root_password (default false) are as in the source, and prepare/verify are unchanged. The role uses ansible.posix (authorized_key), already a galaxy.yml dependency, so galaxy.yml is unchanged. The README Roadmap no longer lists wave 1; CLAUDE.md names the role for the next release. Not verified locally: the molecule scenario (it runs on the kamino-molecule runner in CI) and ansible-test sanity (runs on push). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
This commit is contained in:
1 parent
3d7a4356e6
commit
2713753039
18 files changed
+706
-2
No files matched your search
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- name: Ensure .ssh directory exists
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "/home/{{ item.name }}/.ssh"
|
||||
state: directory
|
||||
owner: "{{ item.name }}"
|
||||
group: "{{ item.name }}"
|
||||
mode: "0700"
|
||||
loop: "{{ user_management_all_users }}"
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
when:
|
||||
- item.state | default('present') == 'present'
|
||||
- not item.system | default(false)
|
||||
|
||||
- name: Enforce authorized_keys authoritatively
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
user: "{{ item.name }}"
|
||||
key: "{{ (user_management_default_authorized_keys + (item.authorized_keys | default([]))) | join('\n') }}"
|
||||
state: present
|
||||
exclusive: "{{ user_management_authoritative }}"
|
||||
loop: "{{ user_management_all_users }}"
|
||||
when:
|
||||
- item.state | default('present') == 'present'
|
||||
- ( user_management_default_authorized_keys + (item.authorized_keys | default([])) ) | length > 0
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
Reference in new issue
Block a user