68 lines
1.4 KiB
YAML
68 lines
1.4 KiB
YAML
- name: Supprime exim
|
|
package:
|
|
name:
|
|
- exim4-base
|
|
- exim4-config
|
|
- exim4-daemon-light
|
|
state: absent
|
|
|
|
- name: Installation postfix
|
|
package:
|
|
name: postfix
|
|
state: present
|
|
|
|
- name: Configuration postfix
|
|
template:
|
|
src: postfix-main.cf.j2
|
|
dest: /etc/postfix/main.cf
|
|
notify:
|
|
- restart postfix
|
|
|
|
- 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: |
|
|
# A completer
|
|
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: |
|
|
# A completer
|
|
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
|
|
|
|
|
|
|