From 886232e1aa0bdf392ea457b8377731df9438831a Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Sat, 11 Jun 2022 02:32:23 +0200 Subject: [PATCH] Fix Fail2ban installation process --- node-configuration/handlers/main.yml | 6 ------ node-configuration/tasks/ssh.yml | 14 +++++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/node-configuration/handlers/main.yml b/node-configuration/handlers/main.yml index 06b0244..b450037 100644 --- a/node-configuration/handlers/main.yml +++ b/node-configuration/handlers/main.yml @@ -5,9 +5,3 @@ name: sshd state: restarted listen: "restart sshd" - -- name: Restart fail2ban service - ansible.builtin.service: - name: fail2ban - state: restarted - listen: "restart fail2ban" diff --git a/node-configuration/tasks/ssh.yml b/node-configuration/tasks/ssh.yml index 803ab68..926c966 100644 --- a/node-configuration/tasks/ssh.yml +++ b/node-configuration/tasks/ssh.yml @@ -1,15 +1,19 @@ --- -- name: Install fail2ban - ansible.builtin.package: - name: fail2ban - state: present +- name: Ensures fail2ban dir exists + file: + path: /etc/fail2ban + state: directory - name: Configure fail2ban copy: src: ../templates/fail2ban.conf dest: /etc/fail2ban/fail2ban.conf backup: yes - notify: restart fail2ban + +- name: Install fail2ban + ansible.builtin.package: + name: fail2ban + state: present - name: Disable password login lineinfile: