fix(system_baseline): accept every size journald reads for the journal cap #449
No files matched your search
@@ -4,6 +4,7 @@ minor_changes:
|
||||
system_baseline - ``system_baseline_journal_max_use`` can be empty to leave journald alone: the role then writes no drop-in and does not
|
||||
restart ``systemd-journald``. The default stays ``200M``.
|
||||
- >-
|
||||
system_baseline - ``system_baseline_journal_max_use`` is checked before any change: it must be empty, ``infinity`` or a number followed by
|
||||
``K``, ``M``, ``G`` or ``T``. A value in any other form, which the role used to write into the drop-in as it was (a bare number, ``1.5G``,
|
||||
a typo, a line break), now stops the run; an empty value used to write an empty ``SystemMaxUse=``.
|
||||
system_baseline - ``system_baseline_journal_max_use`` is checked before any change: it must be empty or a size journald reads, a number
|
||||
with an optional upper-case ``B``, ``K``, ``M``, ``G``, ``T``, ``P`` or ``E``. A value journald rejects, which the role used to write into
|
||||
the drop-in as it was and journald then ignored (``infinity``, a lower-case unit, a line break), now stops the run; an empty value used to
|
||||
write an empty ``SystemMaxUse=``.
|
||||
@@ -45,7 +45,7 @@ templating error instead of the role's own message.
|
||||
| `system_baseline_unattended_upgrade_package_blacklist` | `[]` | no | Packages unattended-upgrades must not touch, as regular expressions (see below) |
|
||||
| `system_baseline_sysctl_hardening` | from profile | no | List of `name` and `value` sysctl pairs |
|
||||
| `system_baseline_secure_tmp_mounts` | from profile | no | Paths remounted as tmpfs with `noexec,nosuid,nodev` |
|
||||
| `system_baseline_journal_max_use` | `200M` | no | Upper bound of the persistent journal (journald `SystemMaxUse`): a number and `K`, `M`, `G` or `T`, or `infinity`. Empty leaves the host alone and removes nothing a former run wrote (see "Leaving journald alone") |
|
||||
| `system_baseline_journal_max_use` | `200M` | no | Upper bound of the persistent journal (journald `SystemMaxUse`): a number with an optional upper-case `B`, `K`, `M`, `G`, `T`, `P` or `E`, such as `1.5G`; a bare number is bytes. journald does not take `infinity`. Empty leaves the host alone and removes nothing a former run wrote (see "Leaving journald alone") |
|
||||
| `system_baseline_tmux_autostart` | `false` | no | Attach interactive SSH logins to a tmux session (`ubuntu_lxc` and `ubuntu_vm` only) |
|
||||
| `system_baseline_tmux_session` | `main` | no | Session name, `A-Za-z0-9_-`, up to 32 characters |
|
||||
| `system_baseline_tmux_windows` | `[]` | no | `{name, command}` windows made when the session is created |
|
||||
@@ -129,7 +129,7 @@ The two task files besides `main` are a supported interface, for a caller that d
|
||||
|
||||
The scenario `molecule/default/` runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It installs packages from the Ubuntu mirrors, so the runner needs outbound network. It runs `check` before the converge (a fresh host) and after it (a configured host).
|
||||
|
||||
- Verify first checks, on the controller, that the role refuses a bad input with its own message before any change: an unknown `system_baseline_system_type`, an unknown `system_baseline_apt_upgrade` (main flow and `update` entry point), a negative reboot throttle or a negative or boolean post-reboot delay (main flow and `reboot` entry point), a line break in `system_baseline_apt_daily_timeout`, a bad `system_baseline_journal_max_use` (a bare number, a space, a line break, a number), and a bad package blacklist (a quote, a null item, a bare string).
|
||||
- Verify first checks, on the controller, that the role refuses a bad input with its own message before any change: an unknown `system_baseline_system_type`, an unknown `system_baseline_apt_upgrade` (main flow and `update` entry point), a negative reboot throttle or a negative or boolean post-reboot delay (main flow and `reboot` entry point), a line break in `system_baseline_apt_daily_timeout`, a bad `system_baseline_journal_max_use` (`infinity`, a lower-case unit, a unit with a trailing `B`, a line break, a number), and a bad package blacklist (a quote, a null item, a bare string).
|
||||
- Converge applies the `ubuntu_lxc` profile, with tmux autostart and `system_baseline_apt_daily_timeout: 1h`. Verify only resolves the `pve` and `ubuntu_vm` profiles and a consumer override, on the controller, asserting the resolved inputs.
|
||||
- Verify checks the installed and removed packages, the journal size cap, the apt settings in `20auto-upgrades` and `50unattended-upgrades`, the locale, and that systemd loaded the `apt-daily.service` timeout.
|
||||
- Verify checks the tmux snippet: root-owned, valid shell, the session and quoted window command, no effect without a terminal, a session name or window command ending in a newline refused, and the file removed when autostart is off.
|
||||
@@ -226,7 +226,7 @@ An upgrade of a Proxmox node can restart Proxmox services while a backup holds a
|
||||
|
||||
### Leaving journald alone
|
||||
|
||||
`system_baseline_journal_max_use: ""` skips the journald task: no drop-in directory, no `50-system-baseline.conf` and no restart of `systemd-journald`. Use it where another drop-in, role or policy owns the journal size. A file an earlier run wrote stays, as for an empty `system_baseline_apt_daily_timeout`; remove it by hand if the cap should go. A value that is not empty and not a size (`300`, `0`, `10 M`, one with a line break) stops the run before any change, in the same way as the apt-daily value.
|
||||
`system_baseline_journal_max_use: ""` skips the journald task: no drop-in directory, no `50-system-baseline.conf` and no restart of `systemd-journald`. Use it where another drop-in, role or policy owns the journal size. A file an earlier run wrote stays, as for an empty `system_baseline_apt_daily_timeout`; remove it by hand if the cap should go. A value that is not empty and not a size journald reads (`infinity`, `10m`, one with a line break) stops the run before any change, in the same way as the apt-daily value.
|
||||
|
||||
### Apt scratch directory
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@ argument_specs:
|
||||
- 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).
|
||||
- >-
|
||||
A number and one of C(K), C(M), C(G), C(T), or C(infinity); anything else (a bare number, a space, a line break) is refused
|
||||
before any change. Empty leaves the host alone: no drop-in is written and journald is not restarted.
|
||||
A size journald reads, a number with an optional upper-case unit C(B), C(K), C(M), C(G), C(T), C(P) or C(E) (a bare number
|
||||
is bytes); anything else (C(infinity), a lower-case unit, a line break) is refused before any change. Empty leaves the host
|
||||
alone: no drop-in is written and journald is not restarted.
|
||||
Clearing the value later does not remove a file already written.
|
||||
system_baseline_tmux_autostart:
|
||||
type: bool
|
||||
|
||||
@@ -132,8 +132,8 @@
|
||||
that: "'system_baseline_apt_daily_timeout must be' in ansible_failed_result.msg | default('')"
|
||||
quiet: true
|
||||
|
||||
# The journal cap is a number and a unit letter, or empty: a bare number (journald would read bytes), a zero, a space, a line break, a
|
||||
# lower-case unit and a number that is not a string each stop the run before any change.
|
||||
# The journal cap is a size journald reads, or empty: infinity (SystemMaxUse does not take it), a lower-case unit, a unit with a trailing B,
|
||||
# a line break and a number that is not a string each stop the run before any change.
|
||||
- name: A bad journal size cap is refused
|
||||
hosts: localhost
|
||||
connection: local
|
||||
@@ -145,10 +145,9 @@
|
||||
vars:
|
||||
system_baseline_refused_journal: "{{ item }}"
|
||||
loop:
|
||||
- "300"
|
||||
- "0"
|
||||
- 10 M
|
||||
- infinity
|
||||
- "10m"
|
||||
- "10MB"
|
||||
- "200M\nStorage=none"
|
||||
- 300
|
||||
|
||||
|
||||
@@ -47,16 +47,18 @@
|
||||
ansible.builtin.import_tasks: validate_reboot.yml
|
||||
tags: always
|
||||
|
||||
# The value is written into a journald drop-in: a number and a unit letter, so a bare number (journald reads it as bytes), a space or a line
|
||||
# break (a second directive) never reaches the file. Empty leaves the host alone, as for the apt-daily timeout.
|
||||
# The value is written into a journald drop-in, so it must be a size journald's parse_size() reads: no line break (a second directive), and
|
||||
# no infinity, which SystemMaxUse does not take. Empty leaves the host alone, as for the apt-daily timeout.
|
||||
- name: Validate the journal size cap
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- system_baseline_journal_max_use is string
|
||||
- system_baseline_journal_max_use == '' or system_baseline_journal_max_use is match('^(infinity|[0-9]+[KMGT])\Z')
|
||||
- >-
|
||||
system_baseline_journal_max_use == ''
|
||||
or system_baseline_journal_max_use is match('^([0-9]+(\.[0-9]*)? *[BKMGTPE] *)*[0-9]+(\.[0-9]*)? *[BKMGTPE]?\Z')
|
||||
fail_msg: >-
|
||||
system_baseline_journal_max_use must be empty (leave journald alone), infinity or a size such as 200M or 2G
|
||||
(a number and one of K, M, G, T; a bare number is refused, journald would read it as bytes).
|
||||
system_baseline_journal_max_use must be empty (leave journald alone) or a size journald reads, such as 200M, 1.5G
|
||||
or 1073741824 (bytes): a number with an optional upper-case B, K, M, G, T, P or E.
|
||||
quiet: true
|
||||
tags: always
|
||||
|
||||
|
||||
Reference in new issue
Block a user