summaryrefslogtreecommitdiffstats
path: root/tasks/mail.yml
blob: 89d853092d96be34a6e7153d4b89c3c71849aea6 (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
- 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
  template: src=etc/postfix/main.cf.j2
            dest=/etc/postfix/main.cf
            owner=root group=root
            mode=0644
  notify:
    - Reload 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