aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mail/tasks/main.yml
blob: 019a2e0f995036863ad186e67847426ae4e36f86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
- name: install packages
  pkgng:
    name: "{{ item }}"
    state: present
  with_items:
    - postfix
    - dovecot
    - opendkim

- name: dkim - create directory
  file:
    path: /usr/local/etc/mail/dkim
    state: directory

- name: dkim - generate domain keys
  include_tasks: dkim-genkey.yml domain={{ item }}
  with_items: "{{ mail.domains }}"

- name: postfix - set as mailer/MTA
  file:
    path: /etc/mail/mailer.conf
    src: /etc/mail/mailer.conf.postfix
    state: link
    force: true

- name: postfix - enable postfix and disable sendmail
  blockinfile:
    path: /etc/rc.conf
    marker: "# {mark} ANSIBLE MANAGED - postfix"
    block: |
      postfix_enable="YES"
      # Completely disable sendmail(8) in favor of Postfix
      sendmail_enable="NO"
      sendmail_submit_enable="NO"
      sendmail_outbound_enable="NO"
      sendmail_msp_queue_enable="NO"

- name: postfix - disable sendmail periodic tasks
  blockinfile:
    path: /etc/periodic.conf
    marker: "# {mark} ANSIBLE MANAGED - postfix"
    block: |
      # Disable sendmail(8) tasks in favor of Postfix
      daily_clean_hoststat_enable="NO"
      daily_status_mail_rejects_enable="NO"
      daily_status_include_submit_mailq="NO"
      daily_submit_queuerun="NO"