feat: use new variable postfix_config

This commit is contained in:
Adrien Waksberg 2021-08-20 18:25:49 +02:00
parent 0098bbc6a1
commit bf42814c6e
4 changed files with 43 additions and 18 deletions

View file

@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
## [Unreleased] ## [Unreleased]
### Breaked
- use new variable postfix_config
### Added ### Added
- feat: add bsd-mailx package - feat: add bsd-mailx package

View file

@ -1,4 +1,5 @@
# Ansible role: Postfix MTA # 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) [![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) [![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 ## Role variables
* `postfix_config` - hash with config
* `postfix_hostname` - the server hostname (default: `ansible_fqdn`) ```
* `postfix_origin` - the domain to send mail (default: `$myhostname`) smtpd_banner: $myhostname ESMTP $mail_name (Debian/GNU)
* `postfix_protocols` - protocols to listen (default: `all`) 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 ## How to use
@ -25,6 +40,7 @@ Install and configure an simple mta with postfix
``` ```
## Development ## Development
### Test syntax with yamllint ### Test syntax with yamllint
* install `python` and `python-pip` * install `python` and `python-pip`

View file

@ -1,4 +1,20 @@
--- ---
postfix_hostname: '{{ ansible_fqdn }}' postfix_hostname: '{{ ansible_fqdn }}'
postfix_origin: '$myhostname' 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) }}'

View file

@ -1,16 +1,5 @@
# {{ ansible_managed }} # {{ ansible_managed }}
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) {% for option, value in postfix_full_config.items() %}
biff = no {{ option }} = {{ value }}
append_dot_mydomain = no {% endfor %}
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 }}