mirror of
https://github.com/Ownercz/ssme-thesis.git
synced 2025-07-12 13:11:33 +02:00
35 lines
1001 B
YAML
35 lines
1001 B
YAML
---
|
|
- name: install fail2ban for Debian
|
|
apt: pkg=fail2ban state={{ fail2ban_pkg_state }}
|
|
when: ansible_os_family == 'Debian'
|
|
tags: package
|
|
|
|
- name: install fail2ban for RedHat
|
|
yum: name=fail2ban state={{ fail2ban_pkg_state }}
|
|
when: ansible_os_family == 'RedHat'
|
|
tags: package
|
|
|
|
- name: configure fail2ban local jails
|
|
action: template src=jail.local.j2 dest=/etc/fail2ban/jail.local mode=0644
|
|
notify: restart fail2ban
|
|
tags: configuration
|
|
|
|
- name: configure fail2ban
|
|
action: template src=config.j2 dest=/etc/fail2ban/fail2ban.conf mode=0644
|
|
notify: restart fail2ban
|
|
tags: configuration
|
|
|
|
- name: ensure file exists
|
|
copy:
|
|
content: ""
|
|
dest: /var/log/auth.log
|
|
|
|
- name: start/stop fail2ban service
|
|
service: name=fail2ban state={{ fail2ban_service_state }} enabled={{ fail2ban_service_enabled }}
|
|
tags: service
|
|
- name: start/stop fail2ban service
|
|
service: name=fail2ban state=stopped
|
|
- name: start/stop fail2ban service
|
|
service: name=fail2ban state=started
|
|
|