diff --git a/php/apc.sls b/php/apc.sls index 6241fad..5c960b7 100644 --- a/php/apc.sls +++ b/php/apc.sls @@ -1,10 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-apc: - pkg.installed: - - order: 180 - -{% endif %} + pkg: + - installed + - name: {{ php.apc_pkg }} diff --git a/php/curl.sls b/php/curl.sls index 8495dfb..ca6d9ba 100644 --- a/php/curl.sls +++ b/php/curl.sls @@ -1,11 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-curl: - pkg.installed: - - name: php5-curl - - order: 180 - -{% endif %} + pkg: + - installed + - name: {{ php.curl_pkg }} diff --git a/php/fpm.sls b/php/fpm.sls index efc71f0..44ee160 100644 --- a/php/fpm.sls +++ b/php/fpm.sls @@ -1,15 +1,13 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-fpm: - pkg.installed: - - name: php5-fpm - - order: 175 - service.running: - - name: php5-fpm + pkg: + - installed + - name: {{ php.fpm_pkg }} + service: + - running + - name: {{ php.fpm_service }} - enable: True - - order: 455 - -{% endif %} diff --git a/php/gd.sls b/php/gd.sls index b8eff90..3769b1a 100644 --- a/php/gd.sls +++ b/php/gd.sls @@ -1,11 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-gd: - pkg.installed: - - name: php5-gd - - order: 180 - -{% endif %} + pkg: + - installed + - name: {{ php.gd_pkg }} diff --git a/php/init.sls b/php/init.sls index c718554..6272e40 100644 --- a/php/init.sls +++ b/php/init.sls @@ -1,11 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php: - pkg.installed: - - name: php5 - - order: 175 - -{% endif %} + pkg: + - installed + - name: {{ php.php_pkg }} diff --git a/php/map.jinja b/php/map.jinja new file mode 100644 index 0000000..c2ddfe3 --- /dev/null +++ b/php/map.jinja @@ -0,0 +1,24 @@ +{% set php = salt['grains.filter_by']({ + 'Debian': { + 'php_pkg': 'php5', + 'apc_pkg': 'php-apc', + 'curl_pkg': 'php5-curl', + 'fpm_pkg': 'php5-fpm', + 'gd_pkg': 'php5-gd', + 'mcrypt_pkg': 'php5-mcrypt', + 'mysql_pkg': 'php5-mysql', + 'pear_pkg': ' php-pear', + 'fpm_service': 'php5-fpm', + }, + 'RedHat': { + 'php_pkg': 'php', + 'apc_pkg': 'php-pecl-apc', + 'curl_pkg': 'curl', + 'fpm_pkg': 'php-fpm', + 'gd_pkg': 'php-gd', + 'mcrypt_pkg': 'php-mcrypt', + 'mysql_pkg': 'php-mysql', + 'pear_pkg': ' php-pear', + 'fpm_service': 'php-fpm', + }, +}, merge=salt['pillar.get']('php:lookup')) %} diff --git a/php/mcrypt.sls b/php/mcrypt.sls index fc19d99..6d155b0 100644 --- a/php/mcrypt.sls +++ b/php/mcrypt.sls @@ -1,11 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-mcrypt: - pkg.installed: - - name: php5-mcrypt - - order: 180 - -{% endif %} + pkg: + - installed + - name: {{ php.mcrypt_pkg }} diff --git a/php/mysql.sls b/php/mysql.sls index a9563e7..054f79b 100644 --- a/php/mysql.sls +++ b/php/mysql.sls @@ -1,11 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-mysql: - pkg.installed: - - name: php5-mysql - - order: 180 - -{% endif %} + pkg: + - installed + - name: {{ php.mysql_pkg }} diff --git a/php/pear.sls b/php/pear.sls index cb9b1b5..c696f8a 100644 --- a/php/pear.sls +++ b/php/pear.sls @@ -1,10 +1,9 @@ +{% from "php/map.jinja" import php with context %} + include: - apt -{% if grains['os']=="Ubuntu" %} - php-pear: - pkg.installed: - - order: 180 - -{% endif %} + pkg: + - installed + - name : {{ php.pear_pkg }}