jcloude/press/playbooks/whitelist_ipaddress.yml
2025-12-23 19:17:16 +08:00

20 lines
429 B
YAML

---
- name: Whitelist IP address
hosts: all
become: yes
become_user: root
gather_facts: no
tasks:
- name: Whitelist IP address in jailconf file
lineinfile:
path: /etc/fail2ban/jail.local
regexp: 'ignoreip(\s*)=(\s)\d.*'
line: 'ignoreip = 127.0.0.1/8 {{ ip_address }}'
state: present
- name: Restart fail2ban
service:
name: fail2ban
state: restarted