2021-12-01 19:13:34 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Install postfix
|
|
|
|
yum:
|
|
|
|
name:
|
|
|
|
- postfix
|
|
|
|
- cyrus-sasl-plain
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
tags: postfix
|
|
|
|
|
|
|
|
- name: Install postfix
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- postfix
|
|
|
|
- libsasl2-modules
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
tags: postfix
|
|
|
|
|
2022-05-12 16:00:11 +02:00
|
|
|
- name: Check if mailman is installed
|
2021-12-01 19:13:34 +01:00
|
|
|
stat: path={{ mailman_root_dir | default('/opt/mailman') }}
|
|
|
|
register: postfix_mailman
|
|
|
|
tags: postfix
|
|
|
|
|
|
|
|
- name: Deploy configuration
|
|
|
|
template: src=main.cf.j2 dest=/etc/postfix/main.cf mode=644 owner=root group=root
|
|
|
|
notify: restart postfix
|
|
|
|
tags: postfix
|
|
|
|
|
2023-11-22 16:00:28 +01:00
|
|
|
- name: Deploy relay_auth
|
2021-12-01 19:13:34 +01:00
|
|
|
template: src=relay_auth.j2 dest=/etc/postfix/relay_auth mode=600 owner=root group=root
|
2023-11-22 16:00:28 +01:00
|
|
|
notify: rehash relay_auth
|
2021-12-01 19:13:34 +01:00
|
|
|
tags: postfix
|
|
|
|
|
2023-11-22 16:00:28 +01:00
|
|
|
- name: Deploy relay_domains
|
|
|
|
template: src=relay_domains.j2 dest=/etc/postfix/relay_domains mode=644 owner=root group=root
|
|
|
|
notify: rehash relay_domains
|
2021-12-01 19:13:34 +01:00
|
|
|
tags: postfix
|
|
|
|
|
2023-11-22 16:00:28 +01:00
|
|
|
- name: Deploy transport_maps
|
|
|
|
template: src=transport_maps.j2 dest=/etc/postfix/transport_maps mode=644 owner=root group=root
|
|
|
|
notify: rehash transport_maps
|
2021-12-01 19:13:34 +01:00
|
|
|
tags: postfix
|
|
|
|
|
|
|
|
- name: Handle postfix port
|
|
|
|
iptables_raw:
|
|
|
|
name: postfix_ports
|
|
|
|
state: "{{ (postfix_src_ip is defined and postfix_src_ip | length > 0) | ternary('present','absent') }}"
|
|
|
|
rules: "-A INPUT -m state --state NEW -p tcp -m multiport --dports {{ postfix_ports | default(['25']) | join(',') }} -s {{ postfix_src_ip | join(',') }} -j ACCEPT"
|
|
|
|
when: iptables_manage | default(True)
|
|
|
|
tags: postfix
|
|
|
|
|
|
|
|
- name: start and enable the service
|
|
|
|
service: name=postfix state=started enabled=True
|
|
|
|
tags: postfix
|
|
|
|
|
|
|
|
...
|