86 lines
1.9 KiB
YAML
86 lines
1.9 KiB
YAML
- name: Supprime exim
|
|
package:
|
|
name:
|
|
- exim4-base
|
|
- exim4-config
|
|
- exim4-daemon-light
|
|
state: absent
|
|
|
|
- name: Installation postfix
|
|
package:
|
|
name:
|
|
- postfix
|
|
- libsasl2-modules
|
|
state: present
|
|
|
|
- name: Configuration postfix
|
|
template:
|
|
src: postfix-main.cf.j2
|
|
dest: /etc/postfix/main.cf
|
|
notify:
|
|
- restart postfix
|
|
|
|
- name: Configuration postfix
|
|
template:
|
|
src: sasl-password-map
|
|
dest: /etc/postfix/sasl-password-map
|
|
mode: 0600
|
|
owner: root
|
|
group: root
|
|
register: _sasl_password_map
|
|
when: common_postfix_configure_sasl is true
|
|
|
|
- shell: |
|
|
cd /etc/postfix/
|
|
postmap sasl-password-map
|
|
when: common_postfix_configure_sasl is true and _sasl_password_map.changed
|
|
|
|
- name: Configuration aliases postfix
|
|
template:
|
|
src: aliases.j2
|
|
dest: /etc/aliases
|
|
register: aliases
|
|
notify:
|
|
- restart postfix
|
|
|
|
- shell: newaliases
|
|
when: aliases.changed
|
|
|
|
- name: Configure sender_canonical_maps_regexp
|
|
blockinfile:
|
|
dest: /etc/postfix/sender_canonical_maps_regexp
|
|
marker: "#### {mark} SECTION CONTROLEE PAR ANSIBLE ####"
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
create: yes
|
|
block: |
|
|
{{ common_postfix_sender_canonical_maps }}
|
|
register: sender_canonical_maps_regexp
|
|
|
|
- name: Configure recipient_canonical_maps_regexp
|
|
blockinfile:
|
|
dest: /etc/postfix/recipient_canonical_maps_regexp
|
|
marker: "#### {mark} SECTION CONTROLEE PAR ANSIBLE ####"
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
create: yes
|
|
block: |
|
|
{{ common_postfix_recipient_canonical_maps }}
|
|
register: recipiend_canonical_maps_regexp
|
|
|
|
- name: postmap
|
|
command: postmap {{ item }}
|
|
args:
|
|
chdir: /etc/postfix/
|
|
with_items:
|
|
- sender_canonical_maps_regexp
|
|
- recipient_canonical_maps_regexp
|
|
when: sender_canonical_maps_regexp.changed or recipiend_canonical_maps_regexp.changed
|
|
notify:
|
|
- restart postfix
|
|
|
|
|
|
|