The README and the comments of tasks/bootstrap.yml, tasks/handback.yml and tasks/lock_root.yml named mortis.kamino.sshd, which the role-independence test refuses in a role's docs. They now name the sshd role (of this Collection), as the ufw role does for system_baseline. The role's own FQCN in its README and scenario stays, as in sshd and ufw. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
18 lines
1.1 KiB
YAML
18 lines
1.1 KiB
YAML
---
|
|
# The root fallback in bootstrap.yml sets ansible_ssh_user as a fact, and a fact lasts for the
|
|
# whole playbook run, not only this play. The sshd role later refuses root (PermitRootLogin
|
|
# no), so a later play that still connected as root would only get in while ssh's ControlPersist
|
|
# connection lived. Switch back to the configured user, now that it exists with its keys, and
|
|
# prove the new connection works. No meta: reset_connection: it ignores `when` (so it ran on
|
|
# every host every run), placed after the switch it reset the configured user's socket rather
|
|
# than root's, and it is not needed: the ssh plugin keys its ControlPersist socket on host, port
|
|
# and user, so the switched user gets a new login anyway (wait_for_connection also resets first).
|
|
- name: Switch back to the configured user
|
|
# Connection var on purpose: it overrides the connection for the rest of the run.
|
|
ansible.builtin.set_fact: # noqa: var-naming[no-role-prefix]
|
|
ansible_ssh_user: "{{ ansible_user }}"
|
|
|
|
- name: Verify access as the configured user
|
|
ansible.builtin.wait_for_connection:
|
|
timeout: 30
|