feat: add transport map

This commit is contained in:
Adrien Waksberg 2021-08-20 18:30:38 +02:00
parent bf42814c6e
commit 7ad695f01d
6 changed files with 26 additions and 0 deletions

View file

@ -12,6 +12,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Added ### Added
- feat: add bsd-mailx package - feat: add bsd-mailx package
- feat: add transport map
### Changed ### Changed

View file

@ -31,6 +31,12 @@ Install and configure an simple mta with postfix
inet_protocols: all inet_protocols: all
``` ```
* `postfix_transports` - hash with the transport configuration
```
google.com: smtp:127.0.0.1
```
## How to use ## How to use
``` ```

View file

@ -18,3 +18,4 @@ postfix_default_config:
inet_interfaces: localhost inet_interfaces: localhost
inet_protocols: all inet_protocols: all
postfix_full_config: '{{ postfix_default_config|combine(postfix_config) }}' postfix_full_config: '{{ postfix_default_config|combine(postfix_config) }}'
postfix_transports: {}

View file

@ -3,3 +3,6 @@
ansible.builtin.service: ansible.builtin.service:
name: postfix name: postfix
state: reloaded state: reloaded
- name: map transport
ansible.builtin.command: postmap /etc/postfix/transport

View file

@ -16,6 +16,16 @@
notify: reload postfix notify: reload postfix
tags: postfix tags: postfix
- name: copy transport configuration
template:
src: transport.j2
dest: /etc/postfix/transport
owner: root
group: root
mode: 0644
notify: map transport
tags: postfix
- name: enable and start service - name: enable and start service
ansible.builtin.service: ansible.builtin.service:
name: postfix name: postfix

5
templates/transport.j2 Normal file
View file

@ -0,0 +1,5 @@
# {{ ansible_managed }}
{% for domain, transport in postfix_transports.items() %}
{{ domain }} {{ transport }}
{% endfor %}