summaryrefslogtreecommitdiffstats
path: root/roles/mtaserver/tasks/config.yml
blob: aaa63758df405ef71df81a82b0b6802df78c5540 (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
- name: Configuration du démon
  template: src=main.cf.j2 dest=/etc/postfix/main.cf
            owner=root
            group=root
            mode=644
  notify: restart postfix

- name: Configuration du master
  copy: src=master.cf dest=/etc/postfix/master.cf
        owner=root
        group=root
        mode=644
  when: is_mtamaster is defined
  notify: restart postfix

- name: Installation des tables dynamiques
  template: src={{ item.name }} dest=/etc/postfix/{{ item.filename }}
            owner=root
            group=root
            mode=644
  notify: postmap
  with_items:
    - { name: 'mydestination_table.j2', filename: 'mydestination_table' }
    - { name: 'network_table.j2', filename: 'network_table' }
    - { name: 'relay_recipients.j2', filename: 'relay_recipients' }

- name: Installation des tables statiques
  copy: src=virtual dest=/etc/postfix/virtual
        owner=root
        group=root
        mode=644
  when: is_mtamaster is defined
  notify: virtualmap

- name: Installation de la table credentials
  copy: src=credentials dest=/etc/postfix/credentials
        owner=root
        group=root
        mode=400
  notify: credentialmap

- name: Configuration alias root
  lineinfile:
    path: /etc/aliases
    line: 'root: casper@casperlefantom.net'
  notify: aliasmap

- name: Configuration alias matthieu
  lineinfile:
    path: /etc/aliases
    line: 'matthieu: casper'
  when: is_mtamaster is defined
  notify: aliasmap

- name: Configuration alias casper
  lineinfile:
    path: /etc/aliases
    line: 'casper: casper@casperlefantom.net'
  notify: aliasmap
  when: is_mtamaster is not defined

- name: Restauration des contextes SELinux des fichiers de conf
  command: /sbin/restorecon -R /etc/postfix/ /etc/aliases
  when: ansible_selinux.status != "disabled"

- name: Ouverture du port SMTP
  firewalld: service=smtp permanent={{ item }} state=enabled
  with_items:
    - true
    - false
  when: ansible_distribution == "Fedora" and is_mtamaster is defined

- name: Ouverture du port Submission
  firewalld: service=smtp-submission permanent={{ item }} state=enabled
  with_items:
    - true
    - false
  when: ansible_distribution == "Fedora" and is_mtamaster is defined