feat: add aliases
This commit is contained in:
parent
7ad695f01d
commit
795b2a0b97
6 changed files with 33 additions and 13 deletions
|
@ -13,6 +13,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
- feat: add bsd-mailx package
|
- feat: add bsd-mailx package
|
||||||
- feat: add transport map
|
- feat: add transport map
|
||||||
|
- feat: add aliases
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,15 @@ Install and configure an simple mta with postfix
|
||||||
google.com: smtp:127.0.0.1
|
google.com: smtp:127.0.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* `postfix_aliases` - hash with the aliases
|
||||||
|
|
||||||
|
```
|
||||||
|
root:
|
||||||
|
- abuse
|
||||||
|
- admin
|
||||||
|
admin: root@local.loc
|
||||||
|
```
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -19,3 +19,4 @@ postfix_default_config:
|
||||||
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: {}
|
postfix_transports: {}
|
||||||
|
postfix_aliases: {}
|
||||||
|
|
|
@ -6,3 +6,6 @@
|
||||||
|
|
||||||
- name: map transport
|
- name: map transport
|
||||||
ansible.builtin.command: postmap /etc/postfix/transport
|
ansible.builtin.command: postmap /etc/postfix/transport
|
||||||
|
|
||||||
|
- name: map aliases
|
||||||
|
ansible.builtin.command: postalias /etc/postfix/aliases
|
||||||
|
|
|
@ -7,23 +7,20 @@
|
||||||
tags: postfix
|
tags: postfix
|
||||||
|
|
||||||
- name: copy file configuration
|
- name: copy file configuration
|
||||||
ansible.builtin.template:
|
|
||||||
src: main.cf.j2
|
|
||||||
dest: /etc/postfix/main.cf
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
notify: reload postfix
|
|
||||||
tags: postfix
|
|
||||||
|
|
||||||
- name: copy transport configuration
|
|
||||||
template:
|
template:
|
||||||
src: transport.j2
|
src: '{{ item }}.j2'
|
||||||
dest: /etc/postfix/transport
|
dest: '/etc/postfix/{{ item }}'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: map transport
|
loop:
|
||||||
|
- main.cf
|
||||||
|
- aliases
|
||||||
|
- transport
|
||||||
|
notify:
|
||||||
|
- reload postfix
|
||||||
|
- map aliases
|
||||||
|
- map transport
|
||||||
tags: postfix
|
tags: postfix
|
||||||
|
|
||||||
- name: enable and start service
|
- name: enable and start service
|
||||||
|
|
9
templates/aliases.j2
Normal file
9
templates/aliases.j2
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% for alias, redirect in postfix_aliases.items() %}
|
||||||
|
{% if redirect is string %}
|
||||||
|
{{ alias }}: {{ redirect }}
|
||||||
|
{% else %}
|
||||||
|
{{ alias }}: {{ redirect|join(',') }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue