make it worjk on debian 12, add firewall

This commit is contained in:
2025-05-02 17:14:02 +02:00
parent 004ade6aa1
commit c5e2ee3a3e

View File

@@ -1,24 +1,38 @@
---
# tasks file for rspamd
- name: configure repo
get_url:
url: https://rspamd.com/rpm-stable/centos-7/rspamd.repo
dest: /etc/yum.repos.d/rspamd.repo
when: ansible_os_family == 'RedHat'
block:
- ansible.builtin.get_url:
url: https://rspamd.com/rpm-stable/centos-7/rspamd.repo
dest: /etc/yum.repos.d/rspamd.repo
- name: get repo gpg key
rpm_key:
key: https://rspamd.com/rpm-stable/gpg.key
state: present
- ansible.builtin.rpm_key:
key: https://rspamd.com/rpm-stable/gpg.key
state: present
- name: install rspamd
yum:
ansible.builtin.package:
state: present
name:
- rspamd
- redis
name: rspamd
- name: open firewall port
when: use_ufw
community.general.ufw:
proto: tcp
port: "11332"
src: "{{ item.ip}}"
comment: "{{ item.comment }}"
rule: allow
loop:
- { ip: 163.172.96.97, comment: submarine }
- { ip: 80.67.185.27, comment: altc01 }
- { ip: 51.15.130.230, comment: mutine }
- { ip: 51.15.99.153, comment: celestine }
- { ip: 51.15.253.78, comment: cosine }
- name: ensure rspamd listen everywhere
lineinfile:
ansible.builtin.lineinfile:
create: true
path: /etc/rspamd/local.d/proxy-normal.inc
regex: "^bind_socket = localhost:11332"
@@ -26,19 +40,14 @@
notify: restart rspamd
- name: binding rspamd to redis
template:
dest: /etc/rspamd/local.d/redis.conf
content: |
read_servers = "127.0.0.1,10.0.0.1";
write_servers = "127.0.0.1";
ansible.builtin.lineinfile:
create: true
path: /etc/rspamd/local.d/redis.conf
line: 'servers: "127.0.0.1"'
notify: restart rspamd
- name: start service
service:
name: "{{ item }}"
ansible.builtin.service:
name: rspamd
state: started
enabled: true
loop:
- redis
- rspamd