You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
#
|
|
# task: configure fail2ban
|
|
#
|
|
# @author Björn Hase <herrhase@node001.net>
|
|
#
|
|
|
|
- name: adding configuration fail2ban/fail2ban.local
|
|
template:
|
|
src: fail2ban/fail2ban.local
|
|
dest: /etc/fail2ban/fail2ban.local
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: adding configuration fail2ban/jail.local
|
|
template:
|
|
src: fail2ban/jail.local
|
|
dest: /etc/fail2ban/jail.local
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: copy filters
|
|
copy:
|
|
src: ../resources/fail2ban/filters/
|
|
dest: /etc/fail2ban/filter.d/
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: find & delete old jails files
|
|
find:
|
|
paths: /etc/fail2ban/jail.d
|
|
register: fail2ban_outdated_files
|
|
|
|
- file:
|
|
state: absent
|
|
path: "{{ item.path }}"
|
|
loop: "{{ fail2ban_outdated_files.files }}"
|
|
when: fail2ban_outdated_files.files is defined
|
|
|
|
- name: enable jails
|
|
copy:
|
|
src: ../ressources/fail2ban/jail/{{ item }}
|
|
dest: /etc/fail2ban/jail.d/{{ item }}
|
|
with_items: "{{ common_fail2ban_jails }}"
|
|
|
|
- notify: restart fail2ban
|