This is a basic Ansible role to manage Postfix. It is limited by design.
postfix_configure_firewalld
(default:true
): Set totrue
to configure firewalld to allow incoming smtp connections. Set tofalse
to skip configuring firewalld.postfix_enable_tls
(default:false
): Set totrue
to enable TLS. Setting it totrue
, requires to set the variablespostfix_ssl_directory
,postfix_ssl_certificate
,postfix_ssl_key
as well. Set tofalse
to skip configuring TLS.postfix_ssl_directory
(default:/etc/postfix/ssl
): Only required whenpostfix_enable_tls
is set totrue
. Path to directory where the SSL files will be placed.postfix_ssl_certificate
: Only required whenpostfix_enable_tls
is set totrue
. Filename of the certificate file. File needs to be present in directoryfiles/
.postfix_ssl_key
: Only required whenpostfix_enable_tls
is set totrue
. Filename of the certificate key file. File needs to be present in directoryfiles/
.mydomain
: Domain name of mail server. Example:sensson.net
.mynetworks
: List of subnets / IP addresses that are allowed to send e-mail through the mail server.
myhostname
(default:{{ ansible_nodename }}
): Hostname of the mailserver. When unset it will default to{{ ansible_nodename }}
.myorigin
(default:{{ ansible_nodename }}
): The domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to. When unset it will default to{{ ansible_nodename }}
.inet_interfaces
(default:all
): The network interface addresses that this mail system receives mail on. When unset it will default toall
.postfix_additional_config
: Postfix has an enormous amount of configurable variables. You may add undefined variables to this variable.
---
# Setting to false will skip firewalld configuration
# Default: true
postfix_configure_firewalld: false
# Setting to true will enable TLS
# Default: false
postfix_enable_tls: true
# Directory to place SSL certificate files, will be ignored when postfix_enable_tls is false
# Default: /etc/postfix/ssl
postfix_ssl_directory: /etc/postfix/ssl
# SSL Certificate files, needs to be placed in directory files/
postfix_ssl_certificate: postfix_ssl_certificate.crt
postfix_ssl_key: postfix_ssl_key.pem
# CONFIGURATION
# REQUIRED
# Postfix configuration
mydomain: example.com
mynetworks:
- 192.168.1.0/24
- 10.0.0.1/32
# OPTIONAL
# Postfix configuration
# myhostname: kvm-smtp01-srv.example.com # When not set, will default to {{ ansible_nodename }}
# myorigin: kvm-smtp01-srv.example.com # When not set, will default to {{ ansible_nodename }}
# inet_interfaces: eth0 # When not set, will default to 'all'
# OPTIONAL
# Place to set undefined values
postfix_additional_config:
smtp_destination_concurrency_limit: 10
smtp_destination_rate_delay: 1s
smtp_extra_recipient_limit: 10
This module has been tested on:
- CentOS 7, 8
This module was made by Polat Consultancy for Sensson.
We strongly believe in the power of open source. This module is our way of saying thanks.