]> git.ekhem.eu.org Git - turnup.git/commitdiff
Add a script for configuring fail2ban.
authorJakub Czajka <jakub@ekhem.eu.org>
Wed, 27 Sep 2023 20:38:08 +0000 (22:38 +0200)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:46:45 +0000 (19:46 +0100)
server/fail2ban.yaml [new file with mode: 0644]

diff --git a/server/fail2ban.yaml b/server/fail2ban.yaml
new file mode 100644 (file)
index 0000000..4295c03
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+- name: Checkout configuration
+  command: |
+    git --work-tree=/tmp --git-dir=/srv/git/server.git checkout main --force \
+      fail2ban/*
+  become: yes
+- name: Install fail2ban
+  package:
+    name:
+      - fail2ban
+    state: latest
+  become: yes
+- name: Ensure fail2ban directory structure exists
+  file:
+    path: "/etc/fail2ban"
+    state: directory
+  become: yes
+- name: Copy to /etc/fail2ban
+  copy:
+    src: "/tmp/fail2ban/{{ item }}"
+    dest: "/etc/fail2ban"
+    remote_src: true
+  become: true
+  with_items:
+    - fail2ban.local
+    - jail.local
+    - paths-common.conf
+- name: Restart fail2ban
+  service:
+    name: fail2ban
+    state: restarted
+  become: yes