summaryrefslogtreecommitdiffstats
path: root/tasks/mail.yml
blob: 8f58c8a00a5b35372b794085f8296b5c2343aabb (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
- name: Install Postfix
  apt: pkg=postfix

- name: Add some common aliases
  lineinfile: dest=/etc/aliases create=yes
              regexp='^{{ item.src }}{{':'}} '
              line='{{ item.src }}{{':'}} {{ item.dst }}'
  with_items:
    - { src: mailer-daemon, dst: 'postmaster'                      }
    - { src: postmaster,    dst: 'root'                            }
    - { src: nobody,        dst: 'root'                            }
    - { src: root,          dst: 'hostmaster@{{ ansible_domain }}' }
  notify:
    - Run newaliases

- name: Configure Postfix (main.cf)
  template: src=etc/postfix/main.cf.j2
            dest=/etc/postfix/main.cf
            owner=root group=root
            mode=0644
  notify:
    - Reload Postfix

- name: Configure Postfix (master.cf)
  copy: src=etc/postfix/master.cf
        dest=/etc/postfix/master.cf
        owner=root group=root
        mode=0644
  notify:
    - Restart Postfix

- name: Start Postfix
  service: name=postfix.service enabled=true state=started

- name: Copy /etc/postfix/tls_policy
  copy: src=etc/postfix/tls_policy
        dest=/etc/postfix/tls_policy
        owner=root group=root
        mode=0644
  notify:
    - Compile /etc/postfix/tls_policy

- meta: flush_handlers

- name: Install s-nail
  apt: pkg=s-nail