2023-10-17 13:02:13 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Install and configure FAIL2BAN
|
2023-10-18 07:06:20 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
2023-10-18 12:24:17 +00:00
|
|
|
# comprobe if fail2ban is installed if not then install fail2ban
|
|
|
|
# Gather the package facts
|
|
|
|
- name: Gather the package facts
|
|
|
|
ansible.builtin.package_facts:
|
|
|
|
manager: auto
|
|
|
|
|
|
|
|
# install packages if is not in the system
|
|
|
|
- name: install fail2ban package if is not in the system
|
2023-10-18 07:06:20 +00:00
|
|
|
apt:
|
2023-10-18 12:24:17 +00:00
|
|
|
name: fail2ban
|
2023-10-18 07:06:20 +00:00
|
|
|
state: present
|
2023-10-18 12:24:17 +00:00
|
|
|
when: "{{ ansible_facts.packages['fail2ban'] }} is not defined "
|
|
|
|
|
|
|
|
# config fail2ban if is there is in the system
|
|
|
|
#- name: config fail2ban
|
|
|
|
# x:
|
|
|
|
# x
|
|
|
|
# x
|
|
|
|
# when: "{{ ansible_facts.packages['fail2ban'] }} is defined "
|