-def after_created
- if node[:lsb][:release].to_f >= 14.04
- notifies :reload, "service[fail2ban]"
- else
- notifies :create, "template[/etc/fail2ban/jail.local]"
+action :create do
+ template "/etc/fail2ban/jail.d/50-#{new_resource.jail}.conf" do
+ cookbook "fail2ban"
+ source "jail.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :name => new_resource.jail,
+ :filter => new_resource.filter,
+ :logpath => new_resource.logpath,
+ :protocol => new_resource.protocol,
+ :ports => new_resource.ports,
+ :maxretry => new_resource.maxretry,
+ :ignoreips => new_resource.ignoreips
+ end
+end
+
+action :delete do
+ file "/etc/fail2ban/jail.d/50-#{new_resource.jail}.conf" do
+ action :delete