aboutsummaryrefslogtreecommitdiff
path: root/roles/postfix/tasks/main.yml
blob: 0b482ea6a4ea714d3f09cc097b2da54428d59ce0 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
- name: install packages
  package:
    name:
      - postfix 
    state: latest

- name: deploy postfix main.cf
  template:
    src: main.cf.j2
    dest: /etc/postfix/main.cf
    owner: root
    group: root
    mode: '0644'

- name: deploy postfix master.cf
  template:
    src: master.cf.j2
    dest: /etc/postfix/master.cf
    owner: root
    group: root
    mode: '0644'

- name: create mailadmin user
  user:
    name: mailadmin
    shell: /usr/sbin/nologin
    password_lock: yes

- name: deploy aliases file
  template:
    src: aliases
    dest: /etc/aliases
    owner: root
    group: root
    mode: '0644'

- name: deploy login_maps
  template:
    src: login_maps
    dest: /etc/postfix/login_maps
    owner: root
    group: root
    mode: '0644'

- name: deploy local_maps
  template:
    src: local_maps
    dest: /etc/postfix/local_maps
    owner: root
    group: root
    mode: '0644'

- name: update address databases
  shell: |
    newaliases
    postmap /etc/postfix/login_maps
    postmap /etc/postfix/local_maps

- name: deploy header checks file
  copy:
    src: header_checks
    dest: /etc/postfix/header_checks
    owner: root
    group: root
    mode: '0644'

- name: deploy body checks file
  copy:
    src: body_checks
    dest: /etc/postfix/body_checks
    owner: root
    group: root
    mode: '0644'

- name: enable postfix
  systemd:
    enabled: yes
    masked: no
    name: postfix

- name: restart postfix
  service:
    name: postfix
    state: restarted