fix(fail2ban-basic): skip enable and restart when check mode previews a first install #12

Merged
claudiomaradonna merged 1 commit from fix/fail2ban-check-mode-first-install into main 2026-09-26 12:04:28 +02:00

Under --check on a host that never had fail2ban, the package install
is only simulated, so there is no fail2ban unit yet: enabling it or
restarting it fails the preview run.

Register the install result and record fail2ban_basic_preview_only
when check mode reports the install as a change. The enable task and
the restart handler skip themselves in that case, so a dry run on a
fresh host completes and a live run is unaffected.

Under --check on a host that never had fail2ban, the package install is only simulated, so there is no fail2ban unit yet: enabling it or restarting it fails the preview run. Register the install result and record fail2ban_basic_preview_only when check mode reports the install as a change. The enable task and the restart handler skip themselves in that case, so a dry run on a fresh host completes and a live run is unaffected.
Under --check on a host that never had fail2ban, the package install
is only simulated, so there is no fail2ban unit yet: enabling it or
restarting it fails the preview run.

Register the install result and record fail2ban_basic_preview_only
when check mode reports the install as a change. The enable task and
the restart handler skip themselves in that case, so a dry run on a
fresh host completes and a live run is unaffected.
claudiomaradonna deleted branch fix/fail2ban-check-mode-first-install 2026-09-26 12:04:33 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/castrum!12
No description provided.