From 66683570e90c5f250aa59c883aaba6c45f3409f8 Mon Sep 17 00:00:00 2001 From: Seth House Date: Thu, 22 Aug 2013 21:14:28 -0600 Subject: [PATCH] Added package-map.jinja --- apache/init.sls | 9 +++------ apache/package-map.jinja | 12 ++++++++++++ pillar.example | 10 +++++++--- 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 apache/package-map.jinja diff --git a/apache/init.sls b/apache/init.sls index e899e60..ebeee20 100644 --- a/apache/init.sls +++ b/apache/init.sls @@ -1,13 +1,10 @@ -{% set pkg = salt['grains.filter_by']({ - 'Debian': {'name': 'apache2'}, - 'RedHat': {'name': 'httpd'}, -}) %} +{% from "apache/package-map.jinja" import apache with context %} apache: pkg: - installed - - name: {{ pkg.name }} + - name: {{ apache.server }} service: - running - - name: {{ pkg.name }} + - name: {{ apache.service }} - enable: True diff --git a/apache/package-map.jinja b/apache/package-map.jinja new file mode 100644 index 0000000..3d4d6f6 --- /dev/null +++ b/apache/package-map.jinja @@ -0,0 +1,12 @@ +{% set apache = salt['grains.filter_by']({ + 'Debian': { + 'server': 'apache2', + 'service': 'apache2', + 'conf': '/etc/apache2/conf.d', + }, + 'RedHat': { + 'server': 'httpd', + 'service': 'httpd', + 'conf': '/etc/httpd/conf.d', + }, +}, merge=salt['pillar.get']('apache:lookup')) %} diff --git a/pillar.example b/pillar.example index 884db9a..df08ce4 100644 --- a/pillar.example +++ b/pillar.example @@ -1,7 +1,11 @@ -# Example for the apache.debian_full formula: - +# ``apache`` formula configuration: +apache: + server: apache2 + service: apache2 + conf: /etc/apache2/conf.d + +# ``apache.debian_full`` formula additional configuration: apache: - php-ini: 'salt://path/to/file/php.ini' register-site: # any name as an array index, and you can duplicate this section {{UNQIUE}}: