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
134 lines
5.2 KiB
YAML
134 lines
5.2 KiB
YAML
---
|
|
argument_specs:
|
|
main:
|
|
short_description: Manage the ansible user, other users and their SSH keys
|
|
description:
|
|
- >-
|
|
Builds the list of managed users, optionally falls back to root with the deploy key when the configured user cannot connect (and hands the
|
|
connection back to that user once it exists),
|
|
creates or removes users, writes C(authorized_keys) and disables cloud-init.
|
|
- Sets the facts C(user_management_all_users) and C(user_management_managed_usernames).
|
|
options:
|
|
user_management_bootstrap:
|
|
type: bool
|
|
default: true
|
|
description:
|
|
- Test the connection as the configured user and fall back to root with the deploy key (never a password) when it fails.
|
|
user_management_install_sudo:
|
|
type: bool
|
|
default: true
|
|
description:
|
|
- Install the sudo package before creating users.
|
|
user_management_disable_cloud_init:
|
|
type: bool
|
|
default: true
|
|
description:
|
|
- Create C(/etc/cloud/cloud-init.disabled) when C(/etc/cloud) exists.
|
|
user_management_authoritative:
|
|
type: bool
|
|
default: true
|
|
description:
|
|
- Make C(authorized_keys) exclusive, so keys that are not configured are removed.
|
|
user_management_lock_root_password:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- >-
|
|
Lock root's password by replacing the shadow field with C(!): no password logs root in and the old hash is removed (C(usermod -L) would keep it).
|
|
Root's shell, home and C(authorized_keys) are left alone, so key login (where sshd allows it) and C(pct enter) still work.
|
|
- Fails when the primary user is root. Leave it false where root's password is a real login, such as a Proxmox node.
|
|
user_management_ansible_user:
|
|
type: dict
|
|
description:
|
|
- >-
|
|
The primary ansible user, always managed. The role default sets C(name) to C(ansible_user), C(password_hash) to
|
|
C(user_management_become_password_hashed) (mandatory), C(groups) to C([sudo]), C(shell) to C(/bin/bash), C(create_home) to true
|
|
and C(state) to C(present).
|
|
- Overriding it replaces the whole dict, so every required key must be given.
|
|
options:
|
|
name:
|
|
type: str
|
|
required: true
|
|
description: Account name.
|
|
password_hash:
|
|
type: raw
|
|
required: true
|
|
no_log: true
|
|
description: Password hash passed to C(ansible.builtin.user).
|
|
groups:
|
|
type: list
|
|
elements: str
|
|
description: Supplementary groups, appended to the existing ones.
|
|
shell:
|
|
type: str
|
|
required: true
|
|
description: Login shell.
|
|
create_home:
|
|
type: bool
|
|
required: true
|
|
description: Create the home directory.
|
|
state:
|
|
type: str
|
|
required: true
|
|
description: C(present) or C(absent).
|
|
authorized_keys:
|
|
type: list
|
|
elements: str
|
|
description: Keys added to C(user_management_default_authorized_keys) for this user.
|
|
user_management_default_authorized_keys:
|
|
type: list
|
|
elements: str
|
|
default: []
|
|
description:
|
|
- Keys written for every managed user.
|
|
user_management_other_users:
|
|
type: list
|
|
elements: dict
|
|
default: []
|
|
description:
|
|
- Additional users. A user with C(state=absent) is removed.
|
|
options:
|
|
name:
|
|
type: str
|
|
required: true
|
|
description: Account name.
|
|
shell:
|
|
type: str
|
|
description: Login shell. Defaults to C(/bin/bash) in the tasks.
|
|
groups:
|
|
type: raw
|
|
description: Supplementary groups, as a list or a comma separated string.
|
|
append:
|
|
type: bool
|
|
description: Append to the groups instead of replacing them. Defaults to true in the tasks.
|
|
create_home:
|
|
type: bool
|
|
description: Create the home directory. Defaults to true in the tasks.
|
|
password_hash:
|
|
type: raw
|
|
no_log: true
|
|
description: Password hash. Omitted when not set.
|
|
comment:
|
|
type: str
|
|
description: GECOS comment.
|
|
system:
|
|
type: bool
|
|
description: Create a system account. Defaults to false in the tasks.
|
|
state:
|
|
type: str
|
|
description: C(present) or C(absent). Defaults to C(present) in the tasks.
|
|
authorized_keys:
|
|
type: list
|
|
elements: str
|
|
description: Keys added to C(user_management_default_authorized_keys) for this user.
|
|
user_management_remove_home:
|
|
type: bool
|
|
default: true
|
|
description:
|
|
- Remove the home directory of users whose state is absent.
|
|
user_management_become_password_hashed:
|
|
type: raw
|
|
no_log: true
|
|
description:
|
|
- Password hash of the primary user, read by the C(user_management_ansible_user) default with C(mandatory). Normally vaulted in host_vars.
|