--- argument_specs: main: short_description: Apply the OS baseline for a system type description: - >- Validates C(system_baseline_system_type) and, when C(system_baseline_tmux_autostart) is true, the tmux session name and windows, then runs the update (unless C(system_baseline_update) is false), packages, unattended-upgrades, locale, timezone, journald, sysctl, tmpfs, tmux and reboot task files, in that order. - Needs gathered facts, because the reboot check reads C(ansible_os_family). - >- The resolved inputs C(system_baseline_profile), C(system_baseline_essential_packages), C(system_baseline_remove_packages), C(system_baseline_apt_periodic_settings), C(system_baseline_apt_upgrade), C(system_baseline_unattended_upgrade_settings), C(system_baseline_unattended_upgrade_origins), C(system_baseline_sysctl_hardening) and C(system_baseline_secure_tmp_mounts) are deliberately not listed. Their defaults are Jinja that indexes C(system_baseline_profiles) with C(system_baseline_system_type), and the argument spec is validated (templated) before tasks/validate.yml runs, so listing them would fail on an invalid C(system_baseline_system_type) with a templating error ahead of the role's own C(is invalid) message. They are derived from the profile and may be set directly to replace one resolved value (a list or dict, for example C(system_baseline_remove_packages)). options: system_baseline_system_type: type: str required: true description: - >- Selects the profile in C(system_baseline_profiles). One of C(ubuntu_vm), C(ubuntu_lxc) or C(pve); any other value is refused by tasks/validate.yml. - Not restricted by C(choices) so that the refusal keeps its own message. system_baseline_profiles: type: dict description: - >- Policy per system type. Each profile holds C(essential_packages), C(remove_packages), C(apt_periodic_settings), C(apt_upgrade), C(unattended_upgrade_settings), C(unattended_upgrade_origins), C(sysctl_hardening) and C(secure_tmp_mounts). - >- C(unattended_upgrade_origins) is a list of unattended-upgrades C(Origins-Pattern) entries. A non-empty list is written to C(/etc/apt/apt.conf.d/90unattended-upgrades-origins), which clears C(Unattended-Upgrade::Allowed-Origins) and C(Unattended-Upgrade::Origins-Pattern) and sets only these entries, so they replace the distribution default instead of adding to it. An empty or missing list removes that file and leaves the distribution default. The C(pve) profile pins Debian's point-release and security origins; the C(ubuntu_*) profiles pin nothing. Entries may not hold a double quote, a backslash or a line break. - >- C(apt_upgrade) is C(safe) or C(dist) and sets how the role upgrades packages: C(dist) runs C(apt-get dist-upgrade), which can also remove packages that an update replaces. The C(pve) profile uses C(dist), the Ubuntu profiles C(safe). - Overriding it replaces all profiles. To change part of one profile use C(system_baseline_profile_overrides). system_baseline_profile_overrides: type: dict default: {} description: - Sparse overrides keyed by system type and merged recursively into the active profile. Lists inside it are replaced, not merged. system_baseline_journal_max_use: type: str default: 200M description: - Upper bound of the persistent systemd journal (journald C(SystemMaxUse), for example C(200M)). - Written to a drop-in under C(/etc/systemd/journald.conf.d). system_baseline_tmux_autostart: type: bool default: false description: - >- Attach an interactive SSH login to a tmux session, creating it when it does not exist. Installs C(/etc/profile.d/tmux-autostart.sh), which acts only for an interactive login shell with a terminal, so scp, sftp, C(ssh host command) and automation are unaffected. Shells that do not read C(/etc/profile.d) (zsh, fish) are unaffected too. A user opts out with C(~/.no-tmux). Installed only when C(tmux) is in the resolved package list (the C(ubuntu_lxc) and C(ubuntu_vm) profiles); with false, or without tmux, the file is removed. A failed attach leaves a plain shell; detaching ends the SSH connection. system_baseline_tmux_session: type: str default: main description: - Name of the session, 1 to 32 characters of C(A-Za-z0-9_-). Checked only when C(system_baseline_tmux_autostart) is true. system_baseline_tmux_windows: type: list elements: dict default: [] description: - >- Windows made when the session is created (a login that only re-attaches adds none), next to a plain shell. A window closes when its command exits. The commands come from the inventory and are shell-quoted, but they run as the user who logs in, are readable by every user on the host and show in C(ps): put no secret in one. They run with C(sh -c) from the tmux server started by the first login, before C(~/.profile) is read, so use absolute paths for anything outside the default C(PATH). options: name: type: str required: true description: - Window name, 1 to 32 characters of C(A-Za-z0-9_-). command: type: str required: true description: - One-line shell command (no line break) run in the window. system_baseline_timezone: type: str default: Etc/UTC description: - Timezone name as reported by C(timedatectl). system_baseline_locale: type: str default: en_US.UTF-8 description: - Locale generated and set as C(LANG). system_baseline_reboot_if_required: type: bool default: true description: - Reboot when C(/var/run/reboot-required) exists after the run. system_baseline_unattended_upgrade_package_blacklist: type: list elements: str default: [] description: - >- Packages unattended-upgrades must leave alone, for a host whose kernel or drivers must not change. Entries are regular expressions matched against the package name, so C(linux-image-.*) covers every kernel image; anchor an entry (C(^name$)) when it must not match longer names too. - >- A non-empty list is written to C(/etc/apt/apt.conf.d/90unattended-upgrades-blacklist) as C(Unattended-Upgrade::Package-Blacklist). apt appends list entries across files, so these are added to those of C(50unattended-upgrades). An empty list removes the file. An entry may not hold a double quote, a backslash or a line break. system_baseline_update: type: bool default: true description: - >- Run the package update (apt update, upgrade, autoremove and autoclean) in this flow. false skips it, for hosts patched by a separate flow; the reboot check still runs, so set C(system_baseline_reboot_if_required) as well when that flow also owns the reboot. - The C(update) entry point does not read it. - In check mode the main flow skips the upgrade itself (a pending update is not drift); autoremove and autoclean are still checked. update: short_description: Update and upgrade apt packages description: - Runs an apt update, upgrade, autoremove and autoclean, and nothing else. - >- Calling it is a request to update, so it does not read C(system_baseline_update), which only gates the main flow. In check mode it still previews the upgrade. - >- A supported entry point (C(tasks_from=update)) for a caller that drives its own reboot, for example a Kubernetes node patch flow that drains the node first. reboot: short_description: Compute system_baseline_reboot_required and reboot when allowed description: - >- Sets the C(system_baseline_reboot_required) fact from C(/var/run/reboot-required) on Debian family hosts, then reboots when C(system_baseline_reboot_if_required) is true and the fact is true. - >- A supported entry point (C(tasks_from=reboot)). With C(system_baseline_reboot_if_required=false) it only computes the fact and never reboots, so a caller can read C(system_baseline_reboot_required) (bool) and reboot on its own terms, for example after draining a node. The fact name and this behaviour are part of the role's interface. - On a non-Debian host the fact is not set; read it with C(default(false)). - Reads C(ansible_os_family), so facts must be gathered. options: system_baseline_reboot_if_required: type: bool default: true description: - Reboot when a reboot is required.