Browse Source

New structure for new Ubuntu PPA and other fixes (#113)

* Initial commit for new branch

* Quick change to base test files

* Updated map.jinja, added `php` dependency for all subformulas

* Fixing mongo module and map.jinja needed OpenSSL dev libraries

* Should be final changes needed for Mongo module

* Updating Suhosin package since many distros don't have package in their
repos anymore

* Generalizing suhosin module, and updating pillar.example for new PPA

* Adding addtional logic for RedHat based families to Suhosin

* Initial commit of NG refactored map.jinja file

* Deleting FFMpeg state file since the module is quite old, and has been
replaced by using a Composer library. See
https://github.com/PHP-FFMpeg/PHP-FFMpeg for details

* Updating NG formulas for new definitions

* Removing 'twig' as a state since it can be installed via Composer

* Changes to installed.jinja to set correct PHP path based on version

* NG Composer and NG Suhosin changes

* Version bump and deleting README for deleted states

* Finished refactor of NG map.jinja file

* Adding trailing commas (forgot them earler)

* Adding changes list, and modifying map file for missing definitions when
using Ubuntu 16.04 and NOT using a PPA

* Changes needed after performing testing on RHEL 7

* Changes needed for Ubuntu Trusty without using PPA

* Removing testing files; keep on local

* Map changes needed after testing Debian Jessie

* Changed needed for Debian Wheezy

* Adding more pkgs for Arch Linux support

* More ArchLinux support

* Stupid tabs

* Removing extra line breaks, and using the general "use_external_repo" in
the future if DotDeb (Debian) or Webtactic (RedHat)

* Accoutning for Precise `phpenmod` and others
tags/v0.34.0
sc250024 8 years ago
parent
commit
1e3e3032f3
52 changed files with 2410 additions and 1546 deletions
  1. +0
    -11
      README.rst
  2. +1
    -1
      VERSION
  3. +4
    -1
      php/adodb.sls
  4. +4
    -1
      php/apc.sls
  5. +4
    -1
      php/apcu.sls
  6. +4
    -1
      php/bcmath.sls
  7. +4
    -1
      php/cgi.sls
  8. +4
    -1
      php/cli.sls
  9. +9
    -8
      php/composer.sls
  10. +4
    -1
      php/curl.sls
  11. +4
    -1
      php/dev.sls
  12. +4
    -1
      php/fpm.sls
  13. +4
    -1
      php/gd.sls
  14. +4
    -1
      php/imagick.sls
  15. +4
    -1
      php/imap.sls
  16. +19
    -15
      php/init.sls
  17. +4
    -1
      php/intl.sls
  18. +4
    -1
      php/json.sls
  19. +4
    -1
      php/ldap.sls
  20. +4
    -1
      php/mail.sls
  21. +300
    -186
      php/map.jinja
  22. +4
    -1
      php/mbstring.sls
  23. +4
    -1
      php/mcrypt.sls
  24. +4
    -1
      php/memcache.sls
  25. +4
    -1
      php/memcached.sls
  26. +17
    -7
      php/mongo.sls
  27. +4
    -1
      php/mysql.sls
  28. +4
    -1
      php/mysqlnd.sls
  29. +1
    -1
      php/ng/apache2/ini.sls
  30. +1
    -1
      php/ng/apache2/init.sls
  31. +1
    -1
      php/ng/cli/ini.sls
  32. +49
    -2
      php/ng/composer.sls
  33. +0
    -2
      php/ng/ffmpeg.sls
  34. +3
    -1
      php/ng/ini.jinja
  35. +36
    -25
      php/ng/installed.jinja
  36. +4
    -2
      php/ng/macro.jinja
  37. +1658
    -1241
      php/ng/map.jinja
  38. +9
    -2
      php/ng/net6.sls
  39. +89
    -2
      php/ng/suhosin.sls
  40. +0
    -2
      php/ng/twig.sls
  41. +1
    -1
      php/ng/xcache/ini.sls
  42. +4
    -1
      php/oauth.sls
  43. +4
    -1
      php/pear.sls
  44. +4
    -1
      php/pgsql.sls
  45. +4
    -1
      php/readline.sls
  46. +4
    -1
      php/redis.sls
  47. +4
    -1
      php/soap.sls
  48. +4
    -1
      php/sqlite.sls
  49. +87
    -3
      php/suhosin.sls
  50. +4
    -1
      php/xml.sls
  51. +4
    -1
      php/zip.sls
  52. +1
    -1
      pillar.example

+ 0
- 11
README.rst View File

@@ -515,11 +515,6 @@ Installs the php-tidy package.

Installs the php-tcpdf package.

``php.ng.twig``
--------------

Installs the php-twig package.

``php.ng.cache-lite``
--------------

@@ -529,9 +524,3 @@ Installs the php-cache-lite package.
--------------

Installs the php-console-table package.

``php.ng.ffmpeg``
--------------

Installs the php-ffmpeg package and ffmpeg.


+ 1
- 1
VERSION View File

@@ -1 +1 @@
0.0.4
0.1.0

+ 4
- 1
php/adodb.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-adodb:
pkg.installed:

+ 4
- 1
php/apc.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-apc:
pkg.installed:

+ 4
- 1
php/apcu.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-apcu:
pkg.installed:

+ 4
- 1
php/bcmath.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-bcmath:
pkg.installed:

+ 4
- 1
php/cgi.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-cgi:
pkg.installed:

+ 4
- 1
php/cli.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-cli:
pkg.installed:

+ 9
- 8
php/composer.sls View File

@@ -1,13 +1,14 @@
{% from "php/map.jinja" import php with context %}
{% set install_file = php.local_bin + '/' + php.composer_bin %}
{%- from "php/map.jinja" import php with context %}

{% if not salt['config.get']('sudo_user') %}
{% set salt_user = salt['config.get']('user', 'root') %}
{% else %}
{% set salt_user = salt['config.get']('sudo_user', 'root') %}
{% endif %}
{%- set install_file = php.local_bin + '/' + php.composer_bin %}

{% set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}
{%- if not salt['config.get']('sudo_user') %}
{%- set salt_user = salt['config.get']('user', 'root') %}
{%- else %}
{%- set salt_user = salt['config.get']('sudo_user', 'root') %}
{%- endif %}

{%- set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}

include:
- php

+ 4
- 1
php/curl.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-curl:
pkg.installed:

+ 4
- 1
php/dev.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-dev:
pkg.installed:

+ 4
- 1
php/fpm.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-fpm:
pkg.installed:

+ 4
- 1
php/gd.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-gd:
pkg.installed:

+ 4
- 1
php/imagick.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-imagick:
pkg.installed:

+ 4
- 1
php/imap.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-imap:
pkg.installed:

+ 19
- 15
php/init.sls View File

@@ -1,26 +1,30 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

{% if not 'ng' in salt['pillar.get']('php', {}) %}
{%- if not 'ng' in salt['pillar.get']('php', {}) %}

{% if grains['os_family']=="Debian" %}
{% set use_ppa = salt['pillar.get']('php:use_ppa', none) %}
{%- if grains['os'] == "Ubuntu" %}
{%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %}

{% if use_ppa is not none %}
{%- if use_external_repo %}
{%- set external_repo_name = salt['pillar.get']('php:external_repo_name', 'ondrej/php') %}

{% set ppa_name = salt['pillar.get']('php:ppa_name', 'ondrej/php5') %}
php_from_ppa:
pkgrepo.managed:
- ppa: {{ external_repo_name }}
- env:
- LC_ALL: "C.UTF-8"
- require_in:
- pkg: php_from_ppa
pkg.latest:
- name: {{ php.php_pkg }}
- refresh: True

php54:
pkgrepo.managed:
- ppa: {{ ppa_name }}
pkg.latest:
- name: php5
- refresh: True
{%- endif %}

{% endif %}
{% endif %}
{%- endif %}

php:
pkg.installed:
- name: {{ php.php_pkg }}

{% endif %}
{%- endif %}

+ 4
- 1
php/intl.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-intl:
pkg.installed:

+ 4
- 1
php/json.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-json:
pkg.installed:

+ 4
- 1
php/ldap.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-ldap:
pkg.installed:

+ 4
- 1
php/mail.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-mail:
pkg.installed:

+ 300
- 186
php/map.jinja View File

@@ -1,249 +1,363 @@
{% if salt['pillar.get']('php:version')|string == '7.0' %}
# -*- coding: utf-8 -*-
# vim: ft=jinja

{% set php = salt['grains.filter_by']({
'Debian': {
'php_pkg': 'php7.0',
'apc_pkg': 'php7.0-apc',
'apcu_pkg': 'php7.0-apcu',
'cli_pkg': 'php7.0-cli',
'curl_pkg': 'php7.0-curl',
'fpm_pkg': 'php7.0-fpm',
'fpm_service': 'php7.0-fpm',
'gd_pkg': 'php7.0-gd',
'intl_pkg': 'php7.0-intl',
'json_pkg': 'php7.0-json',
'mcrypt_pkg': 'php7.0-mcrypt',
'memcache_pkg': 'php7.0-memcached',
'memcached_pkg': 'php7.0-memcached',
'mysql_pkg': 'php7.0-mysql',
'mbstring_pkg': 'php7.0-mbstring',
'readline_pkg': ' php7.0-readline',
'redis_pkg': 'php7.0-redis',
'xml_pkg': 'php7.0-xml',
'imagick_pkg': 'php7.0-imagick',
'suhosin_pkg': 'php7.0-suhosin',
'pgsql_pkg': 'php7.0-pgsql',
'dev_pkg': 'php7.0-dev',
'zip_pkg': 'php7.0-zip',
'php_ini': '/etc/php7.0/apache2/php.ini',
'sqlite_pkg': 'php7.0-sqlite3',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
'composer_bin': 'composer',
},
}, merge=salt['pillar.get']('php:lookup')) %}

{% else %}

{% if salt['grains.get']('os') == 'Ubuntu' %}
{% if salt['grains.get']('osrelease')|string >= '16.04' %}
{% set php = salt['grains.filter_by']({
'Ubuntu': {
'php_pkg': 'php',
'apc_pkg': 'php',
'apcu_pkg': 'php-apcu',
'cgi_pkg': 'php-cgi',
'cli_pkg': 'php-cli',
'curl_pkg': 'php-curl',
'fpm_pkg': 'php-fpm',
'fpm_service': 'php7.0-fpm',
'gd_pkg': 'php-gd',
'oauth_pkg': 'php-oauth',
'intl_pkg': 'php-intl',
'json_pkg': 'php-json',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php-mbstring',
'mcrypt_pkg': 'php-mcrypt',
'memcache_pkg': 'php-memcache',
'memcached_pkg': 'php-memcached',
'mysql_pkg': 'php-mysql',
'mysqlnd_pkg': 'php',
'pear_pkg': 'php-pear',
'readline_pkg': ' php-readline',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php-sqlite3',
'redis_pkg': 'php-redis',
'xml_pkg': 'php-xml',
'imagick_pkg': 'php-imagick',
'suhosin_pkg': 'php',
'imap_pkg': 'php-imap',
'adodb_pkg': 'libphp-adodb',
'pgsql_pkg': 'php-pgsql',
'ldap_pkg': 'php-ldap',
'php_ini': '/etc/php/7.0/apache2/php.ini',
'dev_pkg': 'php-dev',
'mongo_pecl': 'php-mongodb',
'mongo_ext': 'mongodb.so',
'ext_conf_path': '/etc/php/7.0/mods-available',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
'composer_bin': 'composer',
{%- if salt['grains.get']('os') == "Ubuntu" %}
{%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %}
{%- if use_external_repo %}
{%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}
{%- if salt['grains.get']('osrelease')|string >= '16.04' %}
{# Ubuntu 16.04+ specific PHP definitions #}
{%- set php = salt['grains.filter_by']({
'Ubuntu': {
'adodb_pkg': 'libphp-adodb',
'apc_pkg': 'php-apcu',
'apcu_pkg': 'php-apcu-bc',
'bcmath_pkg': 'php' + php_version + '-bcmath',
'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'pkg-config', 'libsslcommon2-dev', 'gcc', 'make', 'autoconf', 'libc-dev', 'pkg-config'],
'cgi_pkg': 'php' + php_version + '-cgi',
'cli_pkg': 'php' + php_version + '-cli',
'composer_bin': 'composer',
'curl_pkg': 'php' + php_version + '-curl',
'dev_pkg': 'php' + php_version + '-dev',
'ext_conf_path': '/etc/php/' + php_version + '/mods-available',
'fpm_pkg': 'php' + php_version + '-fpm',
'fpm_service': 'php' + php_version + '-fpm',
'gd_pkg': 'php' + php_version + '-gd',
'imagick_pkg': 'php-imagick',
'imap_pkg': 'php' + php_version + '-imap',
'intl_pkg': 'php' + php_version + '-intl',
'json_pkg': 'php' + php_version + '-json',
'ldap_pkg': 'php' + php_version + '-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php' + php_version + '-mbstring',
'mcrypt_pkg': 'php' + php_version + '-mcrypt',
'memcache_pkg': 'php-memcache',
'memcached_pkg': 'php-memcached',
'mongo_ext': 'mongodb.so',
'mongo_pecl': 'mongodb',
'mysql_pkg': 'php' + php_version + '-mysql',
'mysqlnd_pkg': 'php' + php_version + '-mysql',
'oauth_pkg': 'php-oauth',
'pear_pkg': 'php-pear',
'pgsql_pkg': 'php' + php_version + '-pgsql',
'php_ini': '/etc/php/' + php_version + '/apache2/php.ini',
'php_pkg': 'php' + php_version,
'phpenmod_command': 'phpenmod -v' + php_version,
'readline_pkg': 'php' + php_version + '-readline',
'redis_pkg': 'php-redis',
'soap_pkg': 'php' + php_version + '-soap',
'sqlite_pkg': 'php' + php_version + '-sqlite3',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'xml_pkg': 'php' + php_version + '-xml',
'zip_pkg': 'php' + php_version + '-zip',
}
}, grain="os", merge=salt['pillar.get']('php:lookup')) %}
{%- else %}
{# All other Ubuntu PHP definitions #}
{%- set php = salt['grains.filter_by']({
'Ubuntu': {
'adodb_pkg': 'libphp-adodb',
'apc_pkg': 'php-apcu',
'apcu_pkg': 'php-apcu',
'bcmath_pkg': 'php' + php_version + '-bcmath',
'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'gcc', 'make', 'autoconf', 'libc-dev', 'pkg-config'],
'cgi_pkg': 'php' + php_version + '-cgi',
'cli_pkg': 'php' + php_version + '-cli',
'composer_bin': 'composer',
'curl_pkg': 'php' + php_version + '-curl',
'dev_pkg': 'php' + php_version + '-dev',
'ext_conf_path': '/etc/php/' + php_version + '/mods-available',
'fpm_pkg': 'php' + php_version + '-fpm',
'fpm_service': 'php' + php_version + '-fpm',
'gd_pkg': 'php' + php_version + '-gd',
'imagick_pkg': 'php-imagick',
'imap_pkg': 'php' + php_version + '-imap',
'intl_pkg': 'php' + php_version + '-intl',
'json_pkg': 'php' + php_version + '-json',
'ldap_pkg': 'php' + php_version + '-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php' + php_version + '-mbstring',
'mcrypt_pkg': 'php' + php_version + '-mcrypt',
'memcache_pkg': 'php-memcache',
'memcached_pkg': 'php-memcached',
'mongo_ext': 'mongodb.so',
'mongo_pecl': 'mongodb',
'mysql_pkg': 'php' + php_version + '-mysql',
'mysqlnd_pkg': 'php' + php_version + '-mysql',
'oauth_pkg': 'php-oauth',
'pear_pkg': 'php-pear',
'pgsql_pkg': 'php' + php_version + '-pgsql',
'php_ini': '/etc/php/' + php_version + '/apache2/php.ini',
'php_pkg': 'php' + php_version,
'phpenmod_command': 'phpenmod -v' + php_version,
'readline_pkg': 'php' + php_version + '-readline',
'redis_pkg': 'php-redis',
'soap_pkg': 'php' + php_version + '-soap',
'sqlite_pkg': 'php' + php_version + '-sqlite3',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'xml_pkg': 'php' + php_version + '-xml',
'zip_pkg': 'php' + php_version + '-zip',
}
}, grain="os"
, merge=salt['pillar.get']('php:lookup')) %}
{% else %}
{% set php = salt['grains.filter_by']({
'Ubuntu': {
'php_pkg': 'php5',
'apc_pkg': 'php-apc',
'apcu_pkg': 'php5-apcu',
'cgi_pkg': 'php5-cgi',
'cli_pkg': 'php5-cli',
'curl_pkg': 'php5-curl',
'fpm_pkg': 'php5-fpm',
'fpm_service': 'php5-fpm',
'gd_pkg': 'php5-gd',
'oauth_pkg': 'php5-oauth',
'intl_pkg': 'php5-intl',
'json_pkg': 'php5-json',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php5',
'mcrypt_pkg': 'php5-mcrypt',
'memcache_pkg': 'php5-memcache',
'memcached_pkg': 'php5-memcached',
'mysql_pkg': 'php5-mysql',
'mysqlnd_pkg': 'php5-mysqlnd',
'pear_pkg': 'php-pear',
'readline_pkg': ' php5-readline',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php5-sqlite',
'redis_pkg': 'php5-redis',
'xml_pkg': 'php5',
'imagick_pkg': 'php5-imagick',
'suhosin_pkg': 'php5-suhosin',
'imap_pkg': 'php5-imap',
'adodb_pkg': 'php5-adodb',
'pgsql_pkg': 'php5-pgsql',
'ldap_pkg': 'php5-ldap',
'php_ini': '/etc/php5/apache2/php.ini',
'dev_pkg': 'php5-dev',
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/mods-available',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
'composer_bin': 'composer',
},
}, grain='os'
, merge=salt['pillar.get']('php:lookup')) %}
{% endif %}
{% else %}
{% set php = salt['grains.filter_by']({
}, grain="os", merge=salt['pillar.get']('php:lookup')) %}
{%- endif %}
{%- else %}
{%- if salt['grains.get']('osrelease')|string >= '16.04' %}
{# Ubuntu 16.04+ specific PHP definitions #}
{%- set php = salt['grains.filter_by']({
'Ubuntu': {
'adodb_pkg': 'libphp-adodb',
'apc_pkg': 'php',
'apcu_pkg': 'php-apcu',
'bcmath_pkg': 'php-bcmath',
'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'pkg-config', 'libsslcommon2-dev'],
'cgi_pkg': 'php-cgi',
'cli_pkg': 'php-cli',
'composer_bin': 'composer',
'curl_pkg': 'php-curl',
'dev_pkg': 'php-dev',
'ext_conf_path': '/etc/php/7.0/mods-available',
'fpm_pkg': 'php-fpm',
'fpm_service': 'php7.0-fpm',
'gd_pkg': 'php-gd',
'imagick_pkg': 'php-imagick',
'imap_pkg': 'php-imap',
'intl_pkg': 'php-intl',
'json_pkg': 'php-json',
'ldap_pkg': 'php-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php-mbstring',
'mcrypt_pkg': 'php-mcrypt',
'memcache_pkg': 'php-memcache',
'memcached_pkg': 'php-memcached',
'mongo_ext': 'mongodb.so',
'mongo_pecl': 'php-mongodb',
'mysql_pkg': 'php-mysql',
'mysqlnd_pkg': 'php',
'oauth_pkg': 'php-oauth',
'pear_pkg': 'php-pear',
'pgsql_pkg': 'php-pgsql',
'php_ini': '/etc/php/7.0/apache2/php.ini',
'php_pkg': 'php',
'phpenmod_command': 'phpenmod',
'readline_pkg': ' php-readline',
'redis_pkg': 'php-redis',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php-sqlite3',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'xml_pkg': 'php-xml',
'zip_pkg': 'php-zip',
}
}, grain="os", merge=salt['pillar.get']('php:lookup')) %}
{%- else %}
{# All other Ubuntu PHP definitions #}
{%- set php = salt['grains.filter_by']({
'Ubuntu': {
'adodb_pkg': 'php5-adodb',
'apc_pkg': 'php-apc',
'apcu_pkg': 'php5-apcu',
'bcmath_pkg': 'php5',
'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev'],
'cgi_pkg': 'php5-cgi',
'cli_pkg': 'php5-cli',
'composer_bin': 'composer',
'curl_pkg': 'php5-curl',
'dev_pkg': 'php5-dev',
'ext_conf_path': salt['grains.filter_by']({
'precise': '/etc/php5/conf.d',
'default': '/etc/php5/mods-available',
}, grain='oscodename'),
'fpm_pkg': 'php5-fpm',
'fpm_service': 'php5-fpm',
'gd_pkg': 'php5-gd',
'imagick_pkg': 'php5-imagick',
'imap_pkg': 'php5-imap',
'intl_pkg': 'php5-intl',
'json_pkg': 'php5-json',
'ldap_pkg': 'php5-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php5',
'mcrypt_pkg': 'php5-mcrypt',
'memcache_pkg': 'php5-memcache',
'memcached_pkg': 'php5-memcached',
'mongo_ext': 'mongo.so',
'mongo_pecl': 'mongo',
'mysql_pkg': 'php5-mysql',
'mysqlnd_pkg': 'php5-mysqlnd',
'oauth_pkg': 'php5-oauth',
'pear_pkg': 'php-pear',
'pgsql_pkg': 'php5-pgsql',
'php_ini': '/etc/php5/apache2/php.ini',
'php_pkg': 'php5',
'phpenmod_command': salt['grains.filter_by']({
'precise': 'true',
'default': 'php5enmod',
}, grain='oscodename'),
'phpenmod_command': 'php5enmod',
'readline_pkg': ' php5-readline',
'redis_pkg': 'php5-redis',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php5-sqlite',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'xml_pkg': 'php5',
'zip_pkg': 'php5',
},
}, grain='os', merge=salt['pillar.get']('php:lookup')) %}
{%- endif %}
{%- endif %}
{%- else %}
{%- set php = salt['grains.filter_by']({
'Debian': {
'php_pkg': 'php5',
'adodb_pkg': 'php5-adodb',
'apc_pkg': 'php-apc',
'apcu_pkg': 'php5-apcu',
'apcu_pkg': salt['grains.filter_by']({
'wheezy': 'php-apc',
'jessie': 'php5-apcu',
}, grain='oscodename'),
'bcmath_pkg': 'php5-fpm',
'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'build-essential'],
'cgi_pkg': 'php5-cgi',
'cli_pkg': 'php5-cli',
'composer_bin': 'composer',
'curl_pkg': 'php5-curl',
'dev_pkg': 'php5-dev',
'ext_conf_path': '/etc/php5/mods-available',
'fpm_pkg': 'php5-fpm',
'fpm_service': 'php5-fpm',
'gd_pkg': 'php5-gd',
'oauth_pkg': 'php5-oauth',
'imagick_pkg': 'php5-imagick',
'imap_pkg': 'php5-imap',
'intl_pkg': 'php5-intl',
'json_pkg': 'php5-json',
'ldap_pkg': 'php5-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-mail',
'mbstring_pkg': 'php5',
'mcrypt_pkg': 'php5-mcrypt',
'memcache_pkg': 'php5-memcache',
'memcached_pkg': 'php5-memcached',
'mongo_ext': 'mongo.so',
'mongo_pecl': 'mongo',
'mysql_pkg': 'php5-mysql',
'mysqlnd_pkg': 'php5-mysqlnd',
'oauth_pkg': 'php5-oauth',
'pear_pkg': 'php-pear',
'pgsql_pkg': 'php5-pgsql',
'php_ini': '/etc/php5/apache2/php.ini',
'php_pkg': 'php5',
'phpenmod_command': 'php5enmod',
'readline_pkg': ' php5-readline',
'redis_pkg': 'php5-redis',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php5-sqlite',
'redis_pkg': 'php5-redis',
'xml_pkg': 'php5',
'imagick_pkg': 'php5-imagick',
'suhosin_pkg': 'php5-suhosin',
'imap_pkg': 'php5-imap',
'adodb_pkg': 'php5-adodb',
'pgsql_pkg': 'php5-pgsql',
'ldap_pkg': 'php5-ldap',
'php_ini': '/etc/php5/apache2/php.ini',
'dev_pkg': 'php5-dev',
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/mods-available',
'local_bin': '/usr/local/bin',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'composer_bin': 'composer',
'xml_pkg': 'php5',
'zip_pkg': 'php5',
},
'RedHat': {
'php_pkg': 'php',
'apc_pkg': 'php-pecl-apc',
'adodb_pkg': 'php-adodb',
'apc_pkg': 'php-pecl-apcu',
'apcu_pkg': 'php-pecl-apcu',
'bcmath_pkg': 'php-bcmath',
'build_pkgs': ['openssl-devel', 'gcc'],
'cgi_pkg': 'php-cgi',
'cli_pkg': 'php-cli',
'composer_bin': 'composer',
'curl_pkg': 'curl',
'dev_pkg': 'php-devel',
'ext_conf_path': '/etc/php.d',
'fpm_pkg': 'php-fpm',
'fpm_service': 'php-fpm',
'gd_pkg': 'php-gd',
'oauth_pkg': 'php-oauth',
'imagick_pkg': 'php-pecl-imagick',
'imap_pkg': 'php-imap',
'intl_pkg': 'php-intl',
'json_pkg': 'php-common',
'ldap_pkg': 'php-ldap',
'local_bin': '/usr/local/bin',
'mail_pkg': 'php-pear-Mail',
'mbstring_pkg': 'php-mbstring',
'mcrypt_pkg': 'php-mcrypt',
'memcache_pkg': 'php-pecl-memcache',
'memcached_pkg': 'php-pecl-memcached',
'mongo_ext': 'mongo.so',
'mongo_pecl': 'mongo',
'mysql_pkg': 'php-mysql',
'mysqlnd_pkg': 'php-mysqlnd',
'oauth_pkg': 'php-pecl-oauth',
'pear_pkg': 'php-pear',
'readline_pkg': ' php-readline',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php5-sqlite',
'redis_pkg': 'php-redis',
'fpm_service': 'php-fpm',
'xml_pkg': 'php-xml',
'imagick_pkg': 'php-pecl-imagick',
'suhosin_pkg': 'php-suhosin',
'imap_pkg': 'php-imap',
'adodb_pkg': 'php-adodb',
'pgsql_pkg': 'php-pgsql',
'ldap_pkg': 'php-ldap',
'php_ini': '/etc/php.ini',
'dev_pkg': 'php-dev',
'zip_pkg': 'php',
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/conf.d',
'local_bin': '/usr/local/bin',
'php_pkg': 'php',
'readline_pkg': 'php-cli',
'redis_pkg': 'php-pecl-redis',
'soap_pkg': 'php-soap',
'sqlite_pkg': 'php-pdo',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'composer_bin': 'composer',
'xml_pkg': 'php-xml',
'zip_pkg': 'php',
},
'Suse': {
'php_pkg': 'php5',
'adodb_pkg': 'php5-dba',
'cli_pkg': 'php5-cli',
'composer_bin': 'composer',
'curl_pkg': 'php5-curl',
'dev_pkg': 'php5-devel',
'ext_conf_path': '/etc/php5/conf.d',
'fpm_pkg': 'php5-fpm',
'fpm_service': 'php5-fpm',
'gd_pkg': 'php5-gd',
'imap_pkg': 'php5-imap',
'intl_pkg': 'php5-intl',
'json_pkg': 'php5-json',
'ldap_pkg': 'php5-ldap',
'local_bin': '/usr/local/bin',
'mbstring_pkg': 'php5-mbstring',
'mcrypt_pkg': 'php5-mcrypt',
'mongo_ext': 'mongo.so',
'mongo_pecl': 'mongo',
'mysql_pkg': 'php5-mysql',
'pear_pkg': 'php5-pear',
'pgsql_pkg': 'php5-pgsql',
'php_ini': '/etc/php5/apache2/php.ini',
'php_pkg': 'php5',
'readline_pkg': ' php5-readline',
'soap_pkg': 'php5-soap',
'sqlite_pkg': 'php5-sqlite',
'fpm_service': 'php5-fpm',
'suhosin5_ext': 'suhosin.so',
'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
'suhosin7_ext': 'suhosin7.so',
'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
'temp_dir': '/tmp',
'xml_pkg': ['php5-xmlreader','php5-xmlwriter','php5-xmlrpc'],
'suhosin_pkg': 'php5-suhosin',
'imap_pkg': 'php5-imap',
'adodb_pkg': 'php5-dba',
'pgsql_pkg': 'php5-pgsql',
'ldap_pkg': 'php5-ldap',
'php_ini': '/etc/php5/apache2/php.ini',
'dev_pkg': 'php5-devel',
'zip_pkg': 'php5-zip',
'mongo_pecl': 'mongo',
'mongo_ext': 'mongo.so',
'ext_conf_path': '/etc/php5/conf.d',
'local_bin': '/usr/local/bin',
'temp_dir': '/tmp',
'composer_bin': 'composer',
},

}, merge=salt['pillar.get']('php:lookup')) %}
{% endif %}
{% endif %}
{%- endif %}

+ 4
- 1
php/mbstring.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-mbstring:
pkg.installed:

+ 4
- 1
php/mcrypt.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-mcrypt:
pkg.installed:

+ 4
- 1
php/memcache.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-memcache:
pkg.installed:

+ 4
- 1
php/memcached.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-memcached:
pkg.installed:

+ 17
- 7
php/mongo.sls View File

@@ -1,21 +1,27 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

{% set version = salt['pillar.get']('php:mongo_version', none) %}
{%- set version = salt['pillar.get']('php:mongo_version', none) %}

include:
- php
- php.xml
- php.dev
- php.pear

php-mongo:
pecl.installed:
- name: {{ php.mongo_pecl }}
- require:
- pkg: {{ php.pear_pkg }}
- defaults: True
{% if version is not none %}
{%- if version is not none %}
- version: {{ version }}
{% endif %}
{%- endif %}
- require:
- pkg: {{ php.pear_pkg }}
- pkg: build_pkgs

build_pkgs:
pkg.installed:
- pkgs: {{ php.build_pkgs }}

php-mongo-conf:
file.managed:
@@ -25,8 +31,12 @@ php-mongo-conf:
- require:
- pkg: {{ php.php_pkg }}

{%- if salt['grains.get']('os_family') == "Debian" %}

php-mongo-enable:
cmd.run:
- name: php5enmod mongo
- name: {{ php.phpenmod_command }} mongo
- require:
- file: php-mongo-conf

{%- endif %}

+ 4
- 1
php/mysql.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-mysql:
pkg.installed:

+ 4
- 1
php/mysqlnd.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-mysqlnd:
pkg.installed:

+ 1
- 1
php/ng/apache2/ini.sls View File

@@ -1,5 +1,5 @@
# Manages the libapache2-mod-php5 main ini file
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}

{% set settings = php.ini.defaults %}

+ 1
- 1
php/ng/apache2/init.sls View File

@@ -1,5 +1,5 @@
# Installs libapache2-mod-php5 package and manages the associated php.ini on os Debian
{% if grains['os_family']=="Debian" %}
{% if grains['os_family'] == "Debian" %}

include:
- php.ng.apache2.install

+ 1
- 1
php/ng/cli/ini.sls View File

@@ -1,5 +1,5 @@
# Manages the php cli main ini file
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}

{% set settings = php.ini.defaults %}

+ 49
- 2
php/ng/composer.sls View File

@@ -1,2 +1,49 @@
{% set state = 'composer' %}
{% include "php/ng/installed.jinja" %}
{% from "php/ng/map.jinja" import php with context %}

{% set install_file = php.lookup.pkgs.local_bin + '/' + php.lookup.pkgs.composer_bin %}

{% if not salt['config.get']('sudo_user') %}
{% set salt_user = salt['config.get']('user', 'root') %}
{% else %}
{% set salt_user = salt['config.get']('sudo_user', 'root') %}
{% endif %}

{% set salt_user_home = salt['user.info'](salt_user).get('home', '/root') %}

include:
- php.ng

get-composer:
file.managed:
- name: {{ php.lookup.pkgs.temp_dir }}/installer
- mode: 0755
- unless: test -f {{ install_file }}
- source: https://getcomposer.org/installer
- source_hash: https://composer.github.io/installer.sig
- require:
- pkg: php

install-composer:
cmd.run:
- name: php {{ php.lookup.pkgs.temp_dir }}/installer --filename={{ php.lookup.pkgs.composer_bin }} --install-dir={{ php.lookup.pkgs.local_bin }}
- unless: test -f {{ install_file }}
- env:
- HOME: {{ salt_user_home }}
- require:
- file: get-composer

# Get COMPOSER_DEV_WARNING_TIME from the installed composer, and if that time has passed
# then it's time to run `composer selfupdate`
#
# It would be nice if composer had a command line switch to get this, but it doesn't,
# and so we just grep for it.
#
update-composer:
cmd.run:
- name: "{{ install_file }} selfupdate"
- unless: test $(grep --text COMPOSER_DEV_WARNING_TIME {{ install_file }} | egrep '^\s*define' | sed -e 's,[^[:digit:]],,g') \> $(php -r 'echo time();')
- cwd: {{ php.lookup.pkgs.local_bin }}
- env:
- HOME: {{ salt_user_home }}
- require:
- cmd: install-composer

+ 0
- 2
php/ng/ffmpeg.sls View File

@@ -1,2 +0,0 @@
{% set state = 'ffmpeg' %}
{% include "php/ng/installed.jinja" %}

+ 3
- 1
php/ng/ini.jinja View File

@@ -1,4 +1,6 @@
# php.ini management macro.
# -*- coding: utf-8 -*-
# vim: ft=jinja
{# php.ini management macro. #}
{% from "php/ng/macro.jinja" import sls_block, serialize %}

{% macro php_ini(filename, opts={}, settings={}) %}

+ 36
- 25
php/ng/installed.jinja View File

@@ -1,9 +1,12 @@
# Template for installing packages.
# -*- coding: utf-8 -*-
# vim: ft=jinja
{# Template for installing packages #}
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/macro.jinja" import sls_block %}


{% set pkginfo = php.lookup.pkgs.get(state) %}
{% set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}

{% set pkgs = [] %}
{% set specials = [] %}
@@ -20,33 +23,41 @@
{% do pkgs.append(pkginfo) %}
{% endif %}

{% if grains['os_family']=="Debian" and (state == 'cli' or state == 'fpm' or state == 'php') %}
{% set use_ppa = salt['pillar.get']('php:use_ppa', False) %}
{% if use_ppa %}
{% if grains['os_family'] == "Debian" and (state == 'cli' or state == 'fpm' or state == 'php') %}
{% set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %}

{% set ppa_name = salt['pillar.get']('php:ppa_name', 'ondrej/php5') %}

php_ppa_env_{{ state }}:
cmd.run:
- name: apt-add-repository -y ppa:{{ ppa_name }}
- env:
- LC_ALL: C.UTF-8
- unless: test -f /etc/apt/sources.list.d/{{ ppa_name|replace('/', '-', 1) }}-trusty.list
{% if use_external_repo %}
{% set external_repo_name = salt['pillar.get']('php:external_repo_name', 'ondrej/php') %}
{% set current_php = salt['alternatives.show_current']('php') %}

php_ppa_{{ state }}:
pkgrepo.managed:
- ppa: {{ ppa_name }}
- require:
- cmd: php_ppa_env_{{ state }}
- require_in:
- pkg: php_install_{{ state }}
pkg.latest:
- name: {{ state }}
- pkgs: {{ pkgs|json() }}
- refresh: True
- onchanges:
- pkgrepo: php_ppa_{{ state }}
{% endif %}
pkgrepo.managed:
- ppa: {{ external_repo_name }}
- env:
- LC_ALL: C.UTF-8
- onlyif:
- test ! -e /etc/apt/sources.list.d/ondrej-ubuntu-php-{{ grains['oscodename'] }}.list {# Trusty and Xenial use different naming schemas #}
- test ! -e /etc/apt/sources.list.d/ondrej-php-{{ grains['oscodename'] }}.list {# Trusty and Xenial use different naming schemas #}
- require_in:
- pkg: php_install_{{ state }}
pkg.latest:
- name: {{ state }}
- pkgs: {{ pkgs|json() }}
- refresh: True
- onchanges:
- pkgrepo: php_ppa_{{ state }}

php_{{ phpng_version }}_link:
alternatives.set:
- name: php
- path: /usr/bin/php{{ phpng_version }}
- require_in:
- pkg: php_install_{{ state }}
- onlyif:
- which php
- test {{ current_php }} != $(which php{{ phpng_version }})

{% endif %}
{% endif %}

php_install_{{ state }}:

+ 4
- 2
php/ng/macro.jinja View File

@@ -1,11 +1,13 @@
# Returns a generic block of values suitable for inclusion in most states.
# -*- coding: utf-8 -*-
# vim: ft=jinja
{# Returns a generic block of values suitable for inclusion in most states #}
{% macro sls_block(dict, ind=4) %}
{% for key, value in dict.items() %}
{{ '-'|indent(ind, True) }} {{ key }}: {{ value|json() }}
{% endfor %}
{% endmacro %}

# Serializes dicts into sequenced data
{# Serializes dicts into sequenced data #}
{%- macro serialize(data) -%}
{%- if data is mapping -%}
{%- set ret = [] -%}

+ 1658
- 1241
php/ng/map.jinja
File diff suppressed because it is too large
View File


+ 9
- 2
php/ng/net6.sls View File

@@ -1,2 +1,9 @@
{% set state = 'net6' %}
{% include "php/ng/installed.jinja" %}
{% if salt['grains.get']('os_family') == "RedHat" %}
{#
Installation of this PEAR module can be done by running
`pear install Net_IPv6` on RedHat based distros
#}
{% else %}
{% set state = 'net6' %}
{% include "php/ng/installed.jinja" %}
{% endif %}

+ 89
- 2
php/ng/suhosin.sls View File

@@ -1,2 +1,89 @@
{% set state = 'suhosin' %}
{% include "php/ng/installed.jinja" %}
{% from "php/ng/map.jinja" import php with context %}

include:
- php.ng
- php.ng.dev

{% set phpng_version = salt['pillar.get']('php:ng:version', '7.0')|string %}

{% if salt['grains.get']('os') == "Ubuntu" %}
{% if phpng_version >= '7.0' %}
{% set suhosin_ext = php.lookup.pkgs.suhosin7_ext %}
{% set suhosin_name = 'suhosin7' %}
{% set suhosin_repo = php.lookup.pkgs.suhosin7_repo %}
{% set tmppath = '/tmp/suhosin7' %}
{% else %}
{% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
{% set suhosin_name = 'suhosin' %}
{% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
{% set tmppath = '/tmp/suhosin5' %}
{% endif %}
{% elif salt['grains.get']('os_family') == "RedHat" %}
{% if grains['osmajorrelease'] == "7" %}
{% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
{% set suhosin_name = 'suhosin' %}
{% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
{% set tmppath = '/tmp/suhosin5' %}
{% else %}
{# RHEL version 6 contains PHP 5.3, which is not supported by Suhosin #}
{% endif %}
{% else %}
{% set suhosin_ext = php.lookup.pkgs.suhosin5_ext %}
{% set suhosin_name = 'suhosin' %}
{% set suhosin_repo = php.lookup.pkgs.suhosin5_repo %}
{% set tmppath = '/tmp/suhosin5' %}
{% endif %}

build-pkgs:
pkg.installed:
- pkgs: {{ php.lookup.pkgs.build_pkgs }}

git:
pkg.installed: []

suhosin-source:
git.latest:
- name: {{ suhosin_repo }}
- target: {{ tmppath }}
- unless:
- test -d {{ tmppath }}
- require:
- pkg: git

install-suhosin:
cmd.run:
- name: |
phpize
./configure
make
make install
- cwd: {{ tmppath }}
- shell: /bin/bash
- runas: root
- unless:
- test -e {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini
- require:
- pkg: build-pkgs
- git: suhosin-source

php-suhosin-conf:
file.managed:
- name: {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini
- contents: |
extension={{ suhosin_ext }}
suhosin.executor.include.whitelist=phar
- require:
- pkg: php
- cmd: install-suhosin
- unless:
- test -e {{ php.lookup.pkgs.ext_conf_path }}/{{ suhosin_name }}.ini

{% if salt['grains.get']('os_family') == "Debian" %}

php-suhosin-enable:
cmd.run:
- name: {{ php.lookup.pkgs.phpenmod_command }} {{ suhosin_name }}
- require:
- file: php-suhosin-conf

{% endif %}

+ 0
- 2
php/ng/twig.sls View File

@@ -1,2 +0,0 @@
{% set state = 'twig' %}
{% include "php/ng/installed.jinja" %}

+ 1
- 1
php/ng/xcache/ini.sls View File

@@ -1,5 +1,5 @@
# Manages the php cli main ini file
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}

{% set settings = php.xcache.ini.defaults %}

+ 4
- 1
php/oauth.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-oauth:
pkg.installed:

+ 4
- 1
php/pear.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-pear:
pkg.installed:

+ 4
- 1
php/pgsql.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-pgsql:
pkg.installed:

+ 4
- 1
php/readline.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-readline:
pkg:

+ 4
- 1
php/redis.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-redis:
pkg.installed:

+ 4
- 1
php/soap.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-soap:
pkg.installed:

+ 4
- 1
php/sqlite.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-sqlite:
pkg.installed:

+ 87
- 3
php/suhosin.sls View File

@@ -1,5 +1,89 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

php-suhosin:
include:
- php
- php.dev

{%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}

{%- if salt['grains.get']('os') == "Ubuntu" %}
{%- if php_version >= '7.0' %}
{%- set suhosin_ext = php.suhosin7_ext %}
{%- set suhosin_name = 'suhosin7' %}
{%- set suhosin_repo = php.suhosin7_repo %}
{%- set tmppath = '/tmp/suhosin7' %}
{%- else %}
{%- set suhosin_ext = php.suhosin5_ext %}
{%- set suhosin_name = 'suhosin' %}
{%- set suhosin_repo = php.suhosin5_repo %}
{%- set tmppath = '/tmp/suhosin5' %}
{%- endif %}
{%- elif salt['grains.get']('os_family') == "RedHat" %}
{%- if grains['osmajorrelease'] == "7" %}
{%- set suhosin_ext = php.suhosin5_ext %}
{%- set suhosin_name = 'suhosin' %}
{%- set suhosin_repo = php.suhosin5_repo %}
{%- set tmppath = '/tmp/suhosin5' %}
{%- else %}
{# RHEL version 6 contains PHP 5.3, which is not supported by Suhosin #}
{%- endif %}
{%- else %}
{%- set suhosin_ext = php.suhosin5_ext %}
{%- set suhosin_name = 'suhosin' %}
{%- set suhosin_repo = php.suhosin5_repo %}
{%- set tmppath = '/tmp/suhosin5' %}
{%- endif %}

build-pkgs:
pkg.installed:
- name: {{ php.suhosin_pkg }}
- pkgs: {{ php.build_pkgs }}

git:
pkg.installed: []

suhosin-source:
git.latest:
- name: {{ suhosin_repo }}
- target: {{ tmppath }}
- unless:
- test -d {{ tmppath }}
- require:
- pkg: git

install-suhosin:
cmd.run:
- name: |
phpize
./configure
make
make install
- cwd: {{ tmppath }}
- shell: /bin/bash
- runas: root
- unless:
- test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
- require:
- pkg: build-pkgs
- git: suhosin-source

php-suhosin-conf:
file.managed:
- name: {{ php.ext_conf_path }}/{{ suhosin_name }}.ini
- contents: |
extension={{ suhosin_ext }}
suhosin.executor.include.whitelist=phar
- require:
- pkg: {{ php.php_pkg }}
- cmd: install-suhosin
- unless:
- test -e {{ php.ext_conf_path }}/{{ suhosin_name }}.ini

{%- if salt['grains.get']('os_family') == "Debian" %}

php-suhosin-enable:
cmd.run:
- name: {{ php.phpenmod_command }} {{ suhosin_name }}
- require:
- file: php-suhosin-conf

{%- endif %}

+ 4
- 1
php/xml.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-xml:
pkg.installed:

+ 4
- 1
php/zip.sls View File

@@ -1,4 +1,7 @@
{% from "php/map.jinja" import php with context %}
{%- from "php/map.jinja" import php with context %}

include:
- php

php-zip:
pkg.installed:

+ 1
- 1
pillar.example View File

@@ -4,7 +4,7 @@ php:
# Use ppa instead the default repository (only Debian family)
use_ppa: True
# Set the ppa name (valid only if use_ppa is not none)
ppa_name: 'ondrej/php5'
ppa_name: 'ondrej/php'
# Set the MongoDB driver version. You can specify (optionally) the driver version
# when you add the php.mongo formula to your execution list
mongo_version: "1.5.5"

Loading…
Cancel
Save