Conversation
| @@ -25,6 +25,7 @@ | |||
| - name: Copy fail2ban custom configuration file into place. | |||
| template: | |||
| src: fail2ban.local.j2 | |||
There was a problem hiding this comment.
Line src: fail2ban.local.j2 needs to removed. Then it should work.
| security_fail2ban_enabled: true | ||
| security_fail2ban_custom_configuration_template: "jail.local.j2" | ||
| security_fail2ban_custom_jail_template: "jail.local.j2" | ||
| security_fail2ban_custom_configuration_template: "fail2ban.local.j2" |
There was a problem hiding this comment.
Technically, the variable name security_fail2ban_custom_configuration_template seems to be good for fail2ban.local. Nevertheless, for backward compatibility it would be better to keep it for the jail.local and create a new variable for the fail2ban.local config.
Proposal:
security_fail2ban_custom_fail2ban_local_template: "fail2ban.local.j2"
security_fail2ban_custom_configuration_template: "jail.local.j2"
In this case only the line
src: fail2ban.local.j2
needs to be changed to
src: "{{ security_fail2ban_custom_fail2ban_local_template }}"
in file tasks/fail2ban.yml
There was a problem hiding this comment.
I think this creates unnecessary confusion, or rather continues the existing confusion in the variable names.
How about creating two new variables, without the custom in the name and removing the old vars content:
| security_fail2ban_custom_configuration_template: "fail2ban.local.j2" | |
| security_fail2ban_jail_template: "jail.local.j2" | |
| security_fail2ban_configuration_template: "fail2ban.local.j2" | |
| # Deprecated variable, please dont't use it anymore: | |
| # security_fail2ban_custom_configuration_template: "jail.local.j2" |
Finally, adding a deprecation warning task. Which at some point could be changed to be a fail:
- name: Assert for deprecated variable
assert:
quiet: true
that:
- security_fail2ban_custom_configuration_template is not defined
fail_msg: |
[DEPRECATION WARNING]: security_fail2ban_custom_configuration_template is deprecated
Origin: {{ role_path }}
Use `security_fail2ban_jail_template` instead.
ignore_errors: true
register: deprecated_variable
- name: Set value of deprecated_variable into correct variable
set_fact:
security_fail2ban_jail_template: "{{ security_fail2ban_custom_configuration_template }}"
when:
- deprecated_variable.failed is true
I have implemented this in my branch here
No description provided.