summaryrefslogtreecommitdiff
path: root/ansible/roles/smarthost-client/tasks/main.yml
blob: 61830c9ea7a5548d3cf37a0b2221bafe3f9635b8 (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
# A mail client needs to send mail. I prefer to send via a local MTA,
# which routes things out via a smarthost.

- name: install postfix and related packages
  apt:
    name:
      - postfix
      - libsasl2-modules
      - mailutils

- name: configure postfix
  template:
    src: main.cf
    dest: /etc/postfix/main.cf
  notify: restart postfix

- name: set mailname
  copy:
    content: "{{ mailname }}\n"
    dest: /etc/mailname
    owner: root
    group: root
    mode: 0644

# Set up the smarthost relay credentials.

- name: set smarthost relay credentials
  template:
    src: sasl_passwd
    dest: /etc/postfix/sasl_passwd
    mode: 0600

- name: postmap relay credentials
  shell: |
    postmap /etc/postfix/sasl_passwd

- name: install aliases
  copy:
    src: aliases
    dest: /etc/aliases
    owner: root
    group: root
    mode: 0644

- name: run newaliases
  shell: newaliases