From b1dbff0957681c548e0f28906302e5a9deda0339 Mon Sep 17 00:00:00 2001 From: Eugene Vereschagin Date: Sun, 16 Feb 2014 22:12:40 +0000 Subject: [PATCH 1/2] Add map.jinja --- template/map.jinja | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 template/map.jinja diff --git a/template/map.jinja b/template/map.jinja new file mode 100644 index 0000000..9e7b254 --- /dev/null +++ b/template/map.jinja @@ -0,0 +1,7 @@ +{% set template = salt['grains.filter_by']({ + 'default': { + 'pkg': 'template', + 'service': 'template', + 'config': '/etc/template.conf', + }, +}, merge=salt['pillar.get']('template:lookup')) %} From 5c180091b99c9c5649e686561a2ddd55670a73ff Mon Sep 17 00:00:00 2001 From: Eugene Vereschagin Date: Sun, 16 Feb 2014 22:19:28 +0000 Subject: [PATCH 2/2] Use map.jinja content in init.sls --- template/init.sls | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/template/init.sls b/template/init.sls index 84fd9fb..fe02749 100644 --- a/template/init.sls +++ b/template/init.sls @@ -1,12 +1,10 @@ -foo-common: - pkg.installed +{% from "template/map.jinja" import template with context %} -{% if grains['id'] == pillar['template']['master'] %} -foo-service: +template: pkg: - installed + - name: {{ template.pkg }} service: - running + - name: {{ template.service }} - enable: True - -{% endif %}