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
30 lines
1.5 KiB
YAML
30 lines
1.5 KiB
YAML
---
|
|
# Locks root's password by replacing the shadow field with "!": no password logs root in,
|
|
# and the old hash is gone, not just prefixed with "!" as usermod -L would leave it (a container
|
|
# created with a shared password would otherwise keep that password's hash, open to an offline
|
|
# crack from the container or a backup of it). The user module compares the fields without their
|
|
# leading "!", so a second run reports ok. Only the password is touched: shell, home and
|
|
# authorized_keys are not passed and stay as they are.
|
|
#
|
|
# This does not break the root fallback in tasks/bootstrap.yml: it logs root in with the deploy
|
|
# key, never a password, and sshd with UsePAM yes (the Ubuntu default and the mortis.kamino.sshd
|
|
# setting) does not treat a "!" hash as a locked account for key authentication. Recovery from the
|
|
# host (pct enter, console as root) needs no password either.
|
|
#
|
|
# Not for a host whose root password is a real login (a Proxmox node: web UI and PAM realm), hence
|
|
# the default false.
|
|
- name: Refuse to lock the primary user's own password
|
|
ansible.builtin.assert:
|
|
that: user_management_ansible_user.name != 'root'
|
|
fail_msg: >-
|
|
user_management_lock_root_password is true but the primary user is root: locking would remove the
|
|
password the role sets for it (and its become password). Connect as a non-root user or leave it false.
|
|
quiet: true
|
|
|
|
- name: Lock root's password
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: root
|
|
password: "!"
|
|
update_password: always
|