This commit is contained in:
parent
d1a382a7fd
commit
6f1f0d9158
1 changed files with 21 additions and 5 deletions
|
|
@ -3,25 +3,41 @@
|
|||
include_vars: "{{ ansible_os_family }}_{{ ansible_distribution_major_version }}.yml"
|
||||
|
||||
- name: Install packages for fail2ban
|
||||
package: name="{{ fail2ban_packages }}" state=latest update_cache=yes
|
||||
package:
|
||||
name: "{{ fail2ban_packages }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Test if paths overrides file exist
|
||||
stat: path=/etc/fail2ban/paths-overrides.local
|
||||
stat:
|
||||
path: /etc/fail2ban/paths-overrides.local
|
||||
register: pathsoverrides
|
||||
|
||||
- name: Touch the standard local file
|
||||
file: path=/etc/fail2ban/paths-overrides.local state=touch owner=root group=root mode=0640
|
||||
file:
|
||||
path: /etc/fail2ban/paths-overrides.local
|
||||
state: touch
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0640
|
||||
when:
|
||||
- not pathsoverrides.stat.exists
|
||||
|
||||
- name: Install fail2ban configuration files
|
||||
template: src="{{ item }}.j2" dest="/{{ item }}" owner=root group=root mode=0644
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
with_items:
|
||||
- etc/fail2ban/jail.local
|
||||
- etc/fail2ban/jail.d/02-services.conf
|
||||
notify: Restart fail2ban
|
||||
|
||||
- name: Enable fail2ban services
|
||||
service: name="fail2ban" enabled=yes
|
||||
service:
|
||||
name: "fail2ban"
|
||||
enabled: yes
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue