Skip to content

Instantly share code, notes, and snippets.

@hatembentayeb
Forked from 5car1z/fail2ban-playbook.yml
Created November 6, 2020 19:24
Show Gist options
  • Save hatembentayeb/9b8adfdf27a6063838a7ee78538a6ff2 to your computer and use it in GitHub Desktop.
Save hatembentayeb/9b8adfdf27a6063838a7ee78538a6ff2 to your computer and use it in GitHub Desktop.
Simple Ansible playbook to install Fail2ban.
---
- name: installs fail2ban on ansible hosts
hosts: fail2ban-hosts
become: yes
tasks:
- name: install apt fail2ban packages
apt:
name: "{{ item }}"
state: latest
update_cache: yes
cache_valid_time: 3600
with_items:
- fail2ban
- sendmail
- name: override the basic fail2ban configuration with .local file
copy:
src: jail.local
dest: /etc/fail2ban/jail.local
owner: root
group: root
mode: 0644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment