X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/004b2d4fea1d51c00896c98fadab13654cf8ff4c..ee2ccdb351eeaa09fde5a9667958cac94977fa0c:/cookbooks/fail2ban/providers/filter.rb diff --git a/cookbooks/fail2ban/providers/filter.rb b/cookbooks/fail2ban/providers/filter.rb index 840dc4825..4e786770e 100644 --- a/cookbooks/fail2ban/providers/filter.rb +++ b/cookbooks/fail2ban/providers/filter.rb @@ -24,11 +24,23 @@ end use_inline_resources action :create do - remote_file "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do - source new_resource.source - owner "root" - group "root" - mode 0644 + if new_resource.source + remote_file "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do + source new_resource.source + owner "root" + group "root" + mode 0644 + end + else + template "/etc/fail2ban/filter.d/#{new_resource.name}.conf" do + cookbook "fail2ban" + source "filter.erb" + owner "root" + group "root" + mode 0644 + variables :failregex => new_resource.failregex, + :ignoreregex => new_resource.ignoreregex + end end end