From 6f85a25336c4ab520ef5b263af528a30261313bd Mon Sep 17 00:00:00 2001 From: Marc Schiffbauer Date: Thu, 26 Feb 2015 16:19:08 +0100 Subject: [PATCH] added map.jinja support --- postfix/init.sls | 15 +++++++++++---- postfix/map.jinja | 10 ++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 postfix/map.jinja diff --git a/postfix/init.sls b/postfix/init.sls index aa4f885..5515ef0 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -1,5 +1,15 @@ +{% from "postfix/map.jinja" import postfix with context %} + postfix: - pkg.installed: [] + {% if postfix.packages is defined %} + pkg.installed: + - names: + {% for name in postfix.packages %} + - {{ name }} + {% endfor %} + - watch_in: + - service: postfix + {% endif %} service.running: - enable: True - require: @@ -7,9 +17,6 @@ postfix: - watch: - pkg: postfix -postfix-policyd-spf-python: - pkg.installed: [] - # manage /etc/aliases if data found in pillar {% if 'aliases' in pillar.get('postfix', '') %} /etc/aliases: diff --git a/postfix/map.jinja b/postfix/map.jinja new file mode 100644 index 0000000..616fa02 --- /dev/null +++ b/postfix/map.jinja @@ -0,0 +1,10 @@ +{% set postfix = salt['grains.filter_by']({ + 'Debian': { + 'packages': ['postfix', 'postfix-policyd-spf-python'], + 'service': 'postfix', + }, + 'Gentoo': { + 'packages': ['mail-mta/postfix'], + 'service': 'postfix', + }, +}, merge=salt['pillar.get']('postfix:lookup')) %}