Files
Defame1297andClaude Opus 5.5 2713753039 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
2026-11-16 17:12:05 +00:00

48 lines
1.4 KiB
YAML

---
- name: Combine all managed users
no_log: true # the ansible user's password_hash is in this list; set_fact prints it at -v
ansible.builtin.set_fact:
user_management_all_users: >-
{{
[user_management_ansible_user]
+ user_management_other_users
}}
tags: always
- name: Extract managed usernames
ansible.builtin.set_fact:
user_management_managed_usernames: >-
{{ user_management_all_users | map(attribute='name') | list }}
tags: always
- name: Bootstrap access (optional)
when: user_management_bootstrap
ansible.builtin.import_tasks: bootstrap.yml
tags: always
- name: Manage system users
ansible.builtin.import_tasks: create_users.yml
tags: create_users
- name: Set SSH keys for created users
ansible.builtin.import_tasks: ssh_keys.yml
tags: ssh_keys
- name: Lock root's password (optional)
when: user_management_lock_root_password
ansible.builtin.import_tasks: lock_root.yml
tags: lock_root_password
- name: Hand the connection back to the configured user
when:
- user_management_bootstrap
- user_management_connection is failed
- not ansible_check_mode # nothing was created in check mode, so the user cannot log in yet
ansible.builtin.import_tasks: handback.yml
tags: always
- name: Disable cloud-init management (if present)
when: user_management_disable_cloud_init
ansible.builtin.import_tasks: disable_cloud_init.yml
tags: disable_cloud_init