]> arthur.barton.de Git - AnsibleRoles.git/blob - roles/postfix/tasks/main.yml
postfix: Don't use Debconf to configure postfix
[AnsibleRoles.git] / roles / postfix / tasks / main.yml
1 ---
2 # postfix tasks
3
4 # Set Debconf to not configure Postfix at all:
5 - name: configure debconf(1) to not configure Postfix
6   tags:
7     - debconf
8     - mail
9     - postfix
10   debconf: >
11     name=postfix
12     question=postfix/main_mailer_type
13     value="No configuration"
14     vtype=select
15
16 - name: install "postfix" package
17   tags:
18     - mail
19     - packages
20     - postfix
21   apt: >
22     state=installed
23     name=postfix
24
25 - name: setup "/etc/mailname"
26   tags:
27     - mail
28     - postfix
29   template: >
30     dest=/etc/mailname
31     group=root
32     mode=0644
33     owner=root
34     src=mailname.j2
35   notify:
36     - restart "postfix"
37
38 - name: set Posfix "myorigin"
39   tags:
40     - mail
41     - postfix
42   lineinfile: >
43     dest=/etc/postfix/main.cf
44     group=root
45     line="myorigin = /etc/mailname"
46     mode=0644
47     owner=root
48     regexp="^myorigin"
49   notify:
50     - restart "postfix"
51
52 - name: set Posfix "myhostname"
53   tags:
54     - mail
55     - postfix
56   lineinfile: >
57     dest=/etc/postfix/main.cf
58     group=root
59     line="myhostname = {{ postfix_mailname }}"
60     mode=0644
61     owner=root
62     regexp="^myhostname"
63   notify:
64     - restart "postfix"
65
66 - name: set Posfix "mydestination"
67   tags:
68     - mail
69     - postfix
70   lineinfile: >
71     dest=/etc/postfix/main.cf
72     line="mydestination = {{ postfix_mailname }}, localhost"
73     regexp="^mydestination"
74   notify:
75     - restart "postfix"
76
77 - name: set Posfix "inet_interfaces"
78   tags:
79     - mail
80     - postfix
81   lineinfile: >
82     dest=/etc/postfix/main.cf
83     line="inet_interfaces = {{ postfix_interfaces }}"
84     regexp="^inet_interfaces"
85   notify:
86     - restart "postfix"
87
88 - name: set Posfix "relayhost"
89   tags:
90     - mail
91     - postfix
92   lineinfile: >
93     dest=/etc/postfix/main.cf
94     line="relayhost = {{ smtp_relay_host }}"
95     regexp="^relayhost"
96   notify:
97     - restart "postfix"
98
99 - name: ensure service "postfix" is enabled and started
100   tags:
101     - mail
102     - postfix
103     - services
104   service: >
105     enabled=yes
106     name=postfix
107     state=started