feat: add rspamd role

This commit is contained in:
s3lph 2023-07-16 00:05:01 +02:00
parent 73fa3b4df1
commit ceef1ada0d
11 changed files with 79 additions and 1 deletions
galaxy.yml
roles
postfix
defaults/main
templates/etc/postfix
rspamd

View file

@ -8,7 +8,7 @@ namespace: s3lph
name: mailserver
# The version of the collection. Must be compatible with semantic versioning
version: '0.3.10'
version: '0.4.0'
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
@ -39,6 +39,7 @@ tags:
- postsrsd
- schleuder
- opendkim
- rspamd
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range

View file

@ -23,6 +23,7 @@ postfix_policyd_spf_enable: no
postfix_srsd_enable: no
postfix_srsd_nodefault: no
postfix_spamassassin_enable: no
postfix_rspamd_enable: no
postfix_easywks_pipe_transport: no
postfix_opendkim_enable: no
postfix_srsd_forward_lookup: "tcp:localhost:10001"

View file

@ -41,6 +41,7 @@ postfix_smtpd_client_restrictions:
postfix_non_smtpd_milters: []
postfix_smtpd_milters: []
postfix_spamassassin_milter: "unix:/spamass/spamass.sock"
postfix_rspamd_milter: "inet:localhost:11332"
postfix_opendkim_milter: "unix:/opendkim/opendkim.sock"
postfix_header_checks: []

View file

@ -134,6 +134,9 @@ smtpd_milters =
{% if postfix_spamassassin_enable %}
{{ postfix_spamassassin_milter }},
{% endif %}
{% if postfix_rspamd_enable %}
{{ postfix_rspamd_milter }},
{% endif %}
{% if postfix_opendkim_enable %}
{{ postfix_opendkim_milter }},
{% endif %}

View file

@ -0,0 +1,8 @@
---
rspamd_redis_servers: [localhost]
rspamd_redis_servers_write: "{{ rspamd_redis_servers }}"
rspamd_controller_password: "q1"
rspamd_greylist_enable: true

View file

@ -0,0 +1,34 @@
---
- name: Render rspamd configuration
ansible.builtin.template:
src: etc/rspamd/local.d/{{ item }}.j2
dest: /etc/rspamd/local.d/{{ item }}
owner: root
group: root
mode: "0644"
loop:
- worker-controller.inc
- redis.conf
notify: reload rspamd
- name: Render /etc/rspamd/local.d/
ansible.builtin.template:
src: etc/rspamd/local.d/worker-controller.inc.j2
dest: /etc/rspamd/local.d/worker-controller.inc
owner: root
group: root
mode: "0644"
notify: reload rspamd
- name: Start and enable redis-server
ansible.builtin.service:
name: redis
state: started
enabled: true
- name: Start and enable rspamd
ansible.builtin.service:
name: rspamd
state: started
enabled: true

View file

@ -0,0 +1,7 @@
---
- name: Install rspamd
ansible.builtin.apt:
name:
- rspamd
- redis-server

View file

@ -0,0 +1,13 @@
---
- name: Install rspamd
ansible.builtin.import_tasks: install.yml
tags:
- "role::rspamd"
- "role::rspamd:install"
- name: Configure rspamd
ansible.builtin.import_tasks: config.yml
tags:
- "role::rspamd"
- "role::rspamd:config"

View file

@ -0,0 +1,3 @@
{{ ansible_managed | comment }}
enable = {{ rspamd_greylist_enable | ternary('true', 'false') }};

View file

@ -0,0 +1,4 @@
{{ ansible_managed | comment }}
read_servers = "{{ rspamd_redis_servers | join(',') }}";
write_servers = "{{ rspamd_redis_servers_write | join(',') }}";

View file

@ -0,0 +1,3 @@
{{ ansible_managed | comment }}
password = "{{ rspamd_controller_password }}";