]> arthur.barton.de Git - AnsibleRoles.git/blob - roles/postfix/tasks/main.yml
postfix: Add "postfix_mailname" variable
[AnsibleRoles.git] / roles / postfix / tasks / main.yml
1 ---
2 # postfix tasks
3
4 - name: configure Postfix "mailname"
5   tags:
6     - mail
7     - packages
8     - postfix
9   debconf: >
10     name=postfix
11     question=postfix/mailname
12     value="{{ postfix_mailname }}"
13     vtype=select
14
15 - name: configure Postfix "destinations"
16   tags:
17     - mail
18     - packages
19     - postfix
20   debconf: >
21     name=postfix
22     question=postfix/destinations
23     value="{{ postfix_mailname }}, $myhostname, localhost.$mydomain, localhost"
24     vtype=select
25
26 - name: install "postfix" package
27   tags:
28     - mail
29     - packages
30     - postfix
31   apt: >
32     state=installed
33     name=postfix
34
35 - name: setup "/etc/mailname"
36   tags:
37     - mail
38     - postfix
39   template: >
40     dest=/etc/mailname
41     group=root
42     mode=644
43     owner=root
44     src=mailname.j2
45   notify:
46     - restart "postfix"
47
48 - name: set Posfix "myorigin"
49   tags:
50     - mail
51     - postfix
52   lineinfile: >
53     dest=/etc/postfix/main.cf
54     group=root
55     line="myorigin = /etc/mailname"
56     mode=644
57     owner=root
58     regexp="^myorigin"
59   notify:
60     - restart "postfix"
61
62 - name: set Posfix "myhostname"
63   tags:
64     - mail
65     - postfix
66   lineinfile: >
67     dest=/etc/postfix/main.cf
68     group=root
69     line="myhostname = {{ inventory_hostname }}"
70     mode=644
71     owner=root
72     regexp="^myhostname"
73   notify:
74     - restart "postfix"
75
76 - name: ensure service "postfix" is enabled and running
77   tags:
78     - mail
79     - postfix
80     - services
81   service: >
82     enabled=yes
83     name=postfix
84     state=running