diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ebcce7..4811816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ## [Unreleased] +### Breaked + +- use new variable postfix_config + ### Added - feat: add bsd-mailx package diff --git a/README.md b/README.md index c052e33..46c69bd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Ansible role: Postfix MTA + [![Version](https://img.shields.io/badge/latest_version-1.0.0-green.svg)](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/releases) [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/ansible-role-postfix_mta/src/branch/master/LICENSE) @@ -11,10 +12,24 @@ Install and configure an simple mta with postfix ## Role variables +* `postfix_config` - hash with config -* `postfix_hostname` - the server hostname (default: `ansible_fqdn`) -* `postfix_origin` - the domain to send mail (default: `$myhostname`) -* `postfix_protocols` - protocols to listen (default: `all`) +``` + smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU) + biff: 'no' + append_dot_mydomain: 'no' + readme_directory: 'no' + compatibility_level: 2 + myhostname: '{{ ansible_fqdn }}' + myorigin: $myhostname + mydestination: $myhostname, localhost + default_transport: smtp + mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 + mailbox_size_limit: '0' + recipient_delimiter: '+' + inet_interfaces: localhost + inet_protocols: all +``` ## How to use @@ -25,6 +40,7 @@ Install and configure an simple mta with postfix ``` ## Development + ### Test syntax with yamllint * install `python` and `python-pip` diff --git a/defaults/main.yml b/defaults/main.yml index beae9c6..823fe30 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,4 +1,20 @@ --- postfix_hostname: '{{ ansible_fqdn }}' postfix_origin: '$myhostname' -postfix_protocols: all +postfix_config: {} +postfix_default_config: + smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU) + biff: 'no' + append_dot_mydomain: 'no' + readme_directory: 'no' + compatibility_level: 2 + myhostname: '{{ ansible_fqdn }}' + myorigin: $myhostname + mydestination: $myhostname, localhost + default_transport: smtp + mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 + mailbox_size_limit: '0' + recipient_delimiter: '+' + inet_interfaces: localhost + inet_protocols: all +postfix_full_config: '{{ postfix_default_config|combine(postfix_config) }}' diff --git a/templates/main.cf.j2 b/templates/main.cf.j2 index 521c56d..724c767 100644 --- a/templates/main.cf.j2 +++ b/templates/main.cf.j2 @@ -1,16 +1,5 @@ # {{ ansible_managed }} -smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) -biff = no -append_dot_mydomain = no -readme_directory = no -compatibility_level = 2 -myhostname = {{ postfix_hostname }} -myorigin = {{ postfix_origin }} -mydestination = $myhostname, localhost -default_transport = smtp -mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 -mailbox_size_limit = 0 -recipient_delimiter = + -inet_interfaces = localhost -inet_protocols = {{ postfix_protocols }} +{% for option, value in postfix_full_config.items() %} +{{ option }} = {{ value }} +{% endfor %}