Oefenweb / ansible-fail2ban

Ansible role to set up fail2ban in Debian-like systems
MIT License
117 stars 55 forks source link

Run correctly in check mode #73

Closed Jakski closed 1 year ago

Jakski commented 2 years ago

Currently running role in check mode results in error like:

TASK [oefenweb.fail2ban : update configuration file - /etc/fail2ban/jail.local]
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleFilterError: Input version value cannot be empty
fatal: [host1]: FAILED! => changed=false 
  msg: 'AnsibleFilterError: Input version value cannot be empty'

It's because fail2ban_version fact is set in runtime, but command module is not executed in check mode by default. Since this task doesn't change configuration it can be always run safely after fail2ban is installed. Disabling check_mode on it, will enable users to view configuration difference without applying it(e.g.: ansible-playbook -C -D site.yml).

tersmitten commented 2 years ago

Looks good! Can you make the PR up-2-date?

Jakski commented 2 years ago

Sure. I've rebased my changes on upstream master branch.