Files
Kamino/roles/sshd/molecule/default/converge.yml
T
Defame1297 2e1ad033e4
Build / build (pull_request) Successful in 51s
Lint / lint (pull_request) Successful in 3m42s
Molecule / molecule (pull_request) Failing after 20m50s
test(roles): run the Ubuntu roles on 24.04 and 26.04 and declare exactly those
Every role except network_interfaces runs its molecule scenarios on the
24.04 and 26.04 images and declares Ubuntu noble and resolute; jammy and
Ubuntu all are dropped. trixie stays declared until the Debian 13 image
(#226) tests it. docker and gitea stay on noble until the 26.04 image
ships gnupg (#378).

Closes #133

Assisted-by: Claude Code
2026-11-25 20:17:53 +00:00

80 lines
2.9 KiB
YAML

---
# The production profile: Ubuntu LXCs. Only the profile name and the user are supplied.
- name: Converge the role with a valid profile
hosts: all
vars:
sshd_profile: ubuntu_lxc
ansible_user: root
roles:
- role: mortis.kamino.sshd
# The plays below only load the role's defaults and run validate.yml, which changes nothing
# on the container. They cover the profiles the converge above cannot run and the values
# the guards accept.
- name: Every profile passes validation and keeps its root login policy
hosts: all
gather_facts: false
tasks:
- name: Validate each profile
ansible.builtin.include_role:
name: mortis.kamino.sshd
tasks_from: validate.yml
public: true
vars:
sshd_profile: "{{ item }}"
loop: [pve, ubuntu_lxc, ubuntu_vm]
- name: Assert the profile data
ansible.builtin.assert:
that:
- sshd_profiles.pve.PermitRootLogin == "prohibit-password"
- sshd_profiles.ubuntu_lxc.PermitRootLogin == "no"
- sshd_profiles.ubuntu_vm.PermitRootLogin == "no"
quiet: true
# Proxmox cluster SSH needs RSA with SHA-2, never SHA-1 ssh-rsa; the others stay ed25519 only.
- name: Assert the key algorithms per profile
ansible.builtin.assert:
that:
- sshd_profiles.pve.HostKeyAlgorithms == "ssh-ed25519,rsa-sha2-512,rsa-sha2-256"
- sshd_profiles.pve.PubkeyAcceptedAlgorithms == "ssh-ed25519,rsa-sha2-512,rsa-sha2-256"
- sshd_settings_defaults.HostKeyAlgorithms == "ssh-ed25519"
- sshd_settings_defaults.PubkeyAcceptedAlgorithms == "ssh-ed25519"
- "'HostKeyAlgorithms' not in sshd_profiles.ubuntu_lxc"
- "'HostKeyAlgorithms' not in sshd_profiles.ubuntu_vm"
quiet: true
# Play vars outrank the role defaults, so the override reaches the merged settings.
- name: A consumer override wins and keeps the rest
hosts: all
gather_facts: false
vars:
sshd_profile: ubuntu_vm
sshd_settings:
MaxAuthTries: "5"
tasks:
- name: Load the role defaults
ansible.builtin.include_role:
name: mortis.kamino.sshd
tasks_from: validate.yml
public: true
- name: Assert the override
ansible.builtin.assert:
that:
- sshd_settings_effective.MaxAuthTries == "5"
- sshd_settings_effective.PermitRootLogin == "no"
- sshd_settings_effective.PubkeyAuthentication == "yes"
quiet: true
- name: The Proxmox guard accepts every value that allows root key login
hosts: all
gather_facts: false
tasks:
- name: Validate the pve profile with each accepted value
ansible.builtin.include_role:
name: mortis.kamino.sshd
tasks_from: validate.yml
vars:
sshd_profile: pve
sshd_settings:
PermitRootLogin: "{{ item }}"
loop: [prohibit-password, without-password, "yes", Prohibit-Password]