Skip to content

Instantly share code, notes, and snippets.

@5car1z
Last active December 9, 2023 18:42
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save 5car1z/76dd1e48f9b16dbd2fb370bba1e2d393 to your computer and use it in GitHub Desktop.
Save 5car1z/76dd1e48f9b16dbd2fb370bba1e2d393 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
@5car1z
Copy link
Author

5car1z commented May 18, 2018

Needs to be accompanied by jail.local template file e.g. https://gist.github.com/5car1z/9c143fd17e61d074ec95207380ba9969

@5car1z
Copy link
Author

5car1z commented May 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment