Add support for using distribution's aliases

This commit is contained in:
Gilles Dartiguelongue 2015-08-22 12:14:21 +02:00
parent c594c1df41
commit 36f627aad8
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,5 @@
{% from "postfix/map.jinja" import postfix with context %}
{% set config = salt['pillar.get']('postfix:config', {}) -%}
{% set processed_parameters = ['aliases', 'virtual'] -%}
{% macro set_parameter(parameter, default=None) -%}
@ -39,8 +41,8 @@
# information on enabling SSL in the smtp client.
{{ set_parameter('myhostname', grains['fqdn']) }}
{{ set_parameter('alias_maps', 'hash:/etc/aliases') }}
{{ set_parameter('alias_database', 'hash:/etc/aliases') }}
{{ set_parameter('alias_maps', 'hash:' ~ postfix.aliases) }}
{{ set_parameter('alias_database', 'hash:' ~ postfix.aliases) }}
{{ set_parameter('mydestination', grains['fqdn'] + ', localhost, localhost.localdomain, ' + grains['domain'] ) }}
{{ set_parameter('relayhost', '') }}
{{ set_parameter('mynetworks', '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128') }}

View File

@ -19,7 +19,7 @@ postfix:
# manage /etc/aliases if data found in pillar
{% if 'aliases' in pillar.get('postfix', '') %}
/etc/aliases:
{{ postfix.aliases_file }}:
file.managed:
- source: salt://postfix/aliases
- user: root
@ -34,7 +34,7 @@ run-newaliases:
- name: newaliases
- cwd: /
- watch:
- file: /etc/aliases
- file: {{ postfix.aliases_file }}
{% endif %}
# manage /etc/postfix/virtual if data found in pillar

View File

@ -3,20 +3,24 @@
'packages': ['postfix', 'postfix-policyd-spf-python'],
'postgrey_pkg': 'postgrey',
'service': 'postfix',
'aliases': '/etc/aliases',
},
'Gentoo': {
'packages': ['mail-mta/postfix'],
'postgrey_pkg': 'postgrey',
'service': 'postfix',
'aliases': '/etc/mail/aliases',
},
'RedHat': {
'packages': ['postfix'],
'postgrey_pkg': 'postgrey',
'service': 'postfix',
'aliases': '/etc/aliases',
},
'Arch' : {
'packages': ['postfix'],
'postgrey_pkg': 'postgrey',
'service': 'postfix',
'aliases': '/etc/aliases',
},
}, merge=salt['pillar.get']('postfix:lookup')) %}