]> git.somenet.org - root/pub/somesible.git/blob - roles/server/mail/spamassassin/tasks/main.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / server / mail / spamassassin / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install spamassassin
9   apt:
10     pkg:
11     - sa-compile
12     - spamassassin
13     - spamc
14     - spamd
15     state: present
16     policy_rc_d: 101
17   tags: "online"
18
19
20 - name: copy spamd defaults
21   copy:
22     src: "{{item}}"
23     dest: "/etc/default/spamd"
24     owner: "root"
25     group: "root"
26     mode: 0644
27   with_first_found:
28     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/spamd.defaults"
29     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/spamd.defaults"
30     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/spamd.defaults"
31     - "default/spamd.defaults"
32   notify: restart spamd.service
33
34
35 - name: copy spamassassin config
36   copy:
37     src: "{{item}}"
38     dest: "/etc/spamassassin/local.cf"
39     mode: 0644
40     owner: "root"
41     group: "root"
42   with_first_found:
43     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/local.cf"
44     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/local.cf"
45     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/local.cf"
46     - "default/local.cf"
47   notify: restart spamd.service
48
49
50 - name: copy spamassassin-expire cronjob
51   copy:
52     src: "{{item}}"
53     dest: "/etc/cron.d/spamassassin-expire"
54     mode: 0644
55     owner: "root"
56     group: "root"
57   with_first_found:
58     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/spamassassin-expire.cron"
59     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/spamassassin-expire.cron"
60     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/spamassassin-expire.cron"
61     - "default/spamassassin-expire.cron"
62
63
64 - name: enable and start spamd.service
65   include_role: name="base/systemd/enable-and-start"
66   vars:
67     service_name: spamd.service