From 09a6a43a5ab16d5cfa0c5e3e0d6890fcb60093f3 Mon Sep 17 00:00:00 2001 From: Filip Polbratt <filip.polbratt@hotmail.com> Date: Wed, 26 Aug 2020 21:05:15 +0200 Subject: [PATCH] Use hash2ini and hiera for fail2ban config --- manifests/fail2ban.pp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/manifests/fail2ban.pp b/manifests/fail2ban.pp index 72058f4..e2f1ef1 100644 --- a/manifests/fail2ban.pp +++ b/manifests/fail2ban.pp @@ -1,4 +1,6 @@ -class lysnetwork::fail2ban { +class lysnetwork::fail2ban ( + $config = undef, +){ if $facts['os']['name'] == 'CentOS' { require ::epel } @@ -15,14 +17,13 @@ class lysnetwork::fail2ban { File['/etc/fail2ban/action.d/iptables-common.conf'],], } - file { - '/etc/fail2ban/jail.local': - ensure => file, - owner => 'root', - group => 'root', - mode => '0644', - source => "puppet:///modules/lysnetwork/fail2ban/jail_local_ssh-${facts['os']['name']}", - notify => Service['fail2ban'], + file { '/etc/fail2ban/jail.local': + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + content => hash2ini($config, {quote_char => ''}), + notify => Service['fail2ban'], } file { -- GitLab