hac/ansible/roles/fail2ban/tasks/main.yml
Ada 5d1011ed41
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add alma linux template generation
2024-03-22 23:47:35 +01:00

26 lines
565 B
YAML
Executable file

---
- name: Install fail2ban
ansible.builtin.apt:
name: "fail2ban"
state: latest
when: ansible_facts['os_family'] == "Debian"
- name: Install fail2ban
ansible.builtin.dnf:
name: "fail2ban"
state: latest
when: ansible_facts['os_family'] == "RedHat"
- name: Copy sshd.conf
ansible.builtin.template:
src: 'sshd.conf.j2'
dest: '/etc/fail2ban/jail.d/sshd.conf'
mode: "0640"
notify:
- Restart fail2ban
- name: Start fail2ban.service
ansible.builtin.systemd:
state: started
name: fail2ban.service
enabled: true