refactor ♻️: Refactor task names and improve formatting in fail2ban.yml #50

Merged
Jose merged 2 commits from dev into main 2026-03-01 13:00:45 +01:00

View File

@@ -156,6 +156,12 @@
}}
when: pve_installed.stat.exists | default(false)
- name: fail2ban | Show firewall config path
ansible.builtin.debug:
msg: >
WARNING: Proxmox firewall config path is: {{ pve_firewall_config}}
when: pve_firewall_config is defined
#################################################
# Detect firewall configuration
#################################################
@@ -172,15 +178,19 @@
register: fw_content
when: fw_stat.stat.exists | default(false)
- name: fail2ban | Debug config contents
ansible.builtin.debug:
msg: >
{{ fw_content }}
when: not pve_firewall_enabled
- name: fail2ban | Determine if firewall enabled
ansible.builtin.set_fact:
pve_firewall_enabled: >-
{{
(fw_stat.stat.exists | default(false)) and
(
(fw_content.content | default('') | b64decode)
is search('enable:\s*1')
)
fw_stat.stat.exists and
(fw_content.content | b64decode)
is search('^enable:\s*1$', multiline=True)
}}
Review

[Lines 190-194] [Score: 2] The change in the condition checking for Proxmox firewall configuration improves readability, but it is a minor modification.

[Lines 190-194] [Score: 2] The change in the condition checking for Proxmox firewall configuration improves readability, but it is a minor modification.
- name: fail2ban | Warn if firewall not enabled
Review

[Lines 156-196] [Score: 3] This block introduces new debug statements and modifies the firewall configuration detection condition. Although it does not introduce any critical or major issues, the new debugging may lead to excessive logging. It is recommended to consider adding an option to control/limit these logs based on the environment.

[Lines 156-196] [Score: 3] This block introduces new debug statements and modifies the firewall configuration detection condition. Although it does not introduce any critical or major issues, the new debugging may lead to excessive logging. It is recommended to consider adding an option to control/limit these logs based on the environment.