Add support for using distribution's aliases
This commit is contained in:
parent
c594c1df41
commit
36f627aad8
@ -1,3 +1,5 @@
|
|||||||
|
{% from "postfix/map.jinja" import postfix with context %}
|
||||||
|
|
||||||
{% set config = salt['pillar.get']('postfix:config', {}) -%}
|
{% set config = salt['pillar.get']('postfix:config', {}) -%}
|
||||||
{% set processed_parameters = ['aliases', 'virtual'] -%}
|
{% set processed_parameters = ['aliases', 'virtual'] -%}
|
||||||
{% macro set_parameter(parameter, default=None) -%}
|
{% macro set_parameter(parameter, default=None) -%}
|
||||||
@ -39,8 +41,8 @@
|
|||||||
# information on enabling SSL in the smtp client.
|
# information on enabling SSL in the smtp client.
|
||||||
|
|
||||||
{{ set_parameter('myhostname', grains['fqdn']) }}
|
{{ set_parameter('myhostname', grains['fqdn']) }}
|
||||||
{{ set_parameter('alias_maps', 'hash:/etc/aliases') }}
|
{{ set_parameter('alias_maps', 'hash:' ~ postfix.aliases) }}
|
||||||
{{ set_parameter('alias_database', 'hash:/etc/aliases') }}
|
{{ set_parameter('alias_database', 'hash:' ~ postfix.aliases) }}
|
||||||
{{ set_parameter('mydestination', grains['fqdn'] + ', localhost, localhost.localdomain, ' + grains['domain'] ) }}
|
{{ set_parameter('mydestination', grains['fqdn'] + ', localhost, localhost.localdomain, ' + grains['domain'] ) }}
|
||||||
{{ set_parameter('relayhost', '') }}
|
{{ set_parameter('relayhost', '') }}
|
||||||
{{ set_parameter('mynetworks', '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128') }}
|
{{ set_parameter('mynetworks', '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128') }}
|
||||||
|
@ -19,7 +19,7 @@ postfix:
|
|||||||
|
|
||||||
# manage /etc/aliases if data found in pillar
|
# manage /etc/aliases if data found in pillar
|
||||||
{% if 'aliases' in pillar.get('postfix', '') %}
|
{% if 'aliases' in pillar.get('postfix', '') %}
|
||||||
/etc/aliases:
|
{{ postfix.aliases_file }}:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://postfix/aliases
|
- source: salt://postfix/aliases
|
||||||
- user: root
|
- user: root
|
||||||
@ -34,7 +34,7 @@ run-newaliases:
|
|||||||
- name: newaliases
|
- name: newaliases
|
||||||
- cwd: /
|
- cwd: /
|
||||||
- watch:
|
- watch:
|
||||||
- file: /etc/aliases
|
- file: {{ postfix.aliases_file }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# manage /etc/postfix/virtual if data found in pillar
|
# manage /etc/postfix/virtual if data found in pillar
|
||||||
|
@ -3,20 +3,24 @@
|
|||||||
'packages': ['postfix', 'postfix-policyd-spf-python'],
|
'packages': ['postfix', 'postfix-policyd-spf-python'],
|
||||||
'postgrey_pkg': 'postgrey',
|
'postgrey_pkg': 'postgrey',
|
||||||
'service': 'postfix',
|
'service': 'postfix',
|
||||||
|
'aliases': '/etc/aliases',
|
||||||
},
|
},
|
||||||
'Gentoo': {
|
'Gentoo': {
|
||||||
'packages': ['mail-mta/postfix'],
|
'packages': ['mail-mta/postfix'],
|
||||||
'postgrey_pkg': 'postgrey',
|
'postgrey_pkg': 'postgrey',
|
||||||
'service': 'postfix',
|
'service': 'postfix',
|
||||||
|
'aliases': '/etc/mail/aliases',
|
||||||
},
|
},
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
'packages': ['postfix'],
|
'packages': ['postfix'],
|
||||||
'postgrey_pkg': 'postgrey',
|
'postgrey_pkg': 'postgrey',
|
||||||
'service': 'postfix',
|
'service': 'postfix',
|
||||||
|
'aliases': '/etc/aliases',
|
||||||
},
|
},
|
||||||
'Arch' : {
|
'Arch' : {
|
||||||
'packages': ['postfix'],
|
'packages': ['postfix'],
|
||||||
'postgrey_pkg': 'postgrey',
|
'postgrey_pkg': 'postgrey',
|
||||||
'service': 'postfix',
|
'service': 'postfix',
|
||||||
|
'aliases': '/etc/aliases',
|
||||||
},
|
},
|
||||||
}, merge=salt['pillar.get']('postfix:lookup')) %}
|
}, merge=salt['pillar.get']('postfix:lookup')) %}
|
||||||
|
Loading…
Reference in New Issue
Block a user