aboutsummaryrefslogtreecommitdiffstats
path: root/roles/postfix_server/tasks/main.yml
blob: 4f22d493665f35bed727e2afb5b579b2a8a66f24 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
- name: install postfix
  dnf:
    name: '{{ postfix_packages }}'
    state: present

- name: request TLS certificate
  include_role:
    name: certbot
  vars:
    certificate_sans: ['{{ postfix_myhostname }}']
    certificate_path: '{{ postfix_certificate_path }}'
    certificate_key_path: '{{ postfix_certificate_key_path }}'
    certificate_owner: postfix
    certificate_hook: systemctl reload postfix

- import_tasks: freeipa.yml
  tags: freeipa

- name: generate dhparams
  openssl_dhparam:
    path: '{{ postfix_dhparams_path }}'
    size: 2048

- name: generate postifx configuration
  template:
    src: etc/postfix/{{ item }}.j2
    dest: /etc/postfix/{{ item }}
  loop:
    - main.cf
    - master.cf
    - virtual_mailboxes.cf
    - virtual_aliases.cf
  notify: restart postfix

- name: configure saslauthd for smtpd
  copy:
    src: etc/sasl2/smtpd.conf
    dest: /etc/sasl2/smtpd.conf
  notify: restart saslauthd

- name: enable saslauthd
  systemd:
    name: saslauthd
    enabled: yes
    state: started

- name: enable postfix
  systemd:
    name: postfix
    enabled: yes
    state: started

- name: open firewall ports
  firewalld:
    service: '{{ item }}'
    permanent: yes
    immediate: yes
    state: enabled
  loop:
    - smtp
    - smtp-submission