Last active
December 9, 2023 18:42
-
-
Save 5car1z/76dd1e48f9b16dbd2fb370bba1e2d393 to your computer and use it in GitHub Desktop.
Simple Ansible playbook to install Fail2ban.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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
https://www.tricksofthetrades.net/2018/05/19/ansible-fail2ban-playbook/