diff --git a/fail2ban/tasks/main.yml b/fail2ban/tasks/main.yml index b5583a98..b9df04ca 100644 --- a/fail2ban/tasks/main.yml +++ b/fail2ban/tasks/main.yml @@ -1,4 +1,26 @@ --- +# We have to copy the local jail before installing the package +# or we risk being jailed by fail2ban + +- name: Prepare /etc/fail2ban + file: + path: /etc/fail2ban + state: directory + owner: root + group: root + mode: "0755" + tags: + - fail2ban + +- name: local jail is installed + template: + src: jail.local.j2 + dest: /etc/fail2ban/jail.local + mode: "0644" + notify: restart fail2ban + tags: + - fail2ban + - name: package is installed apt: name: fail2ban @@ -18,12 +40,3 @@ notify: restart fail2ban tags: - fail2ban - -- name: local jail is installed - template: - src: jail.local.j2 - dest: /etc/fail2ban/jail.local - mode: "0644" - notify: restart fail2ban - tags: - - fail2ban