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
This commit is contained in:
sc250024 2016-12-13 13:37:53 -08:00 committed by Forrest
parent 371fc1f3a7
commit 1e3e3032f3
52 changed files with 2425 additions and 1561 deletions

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.

View File

@ -1 +1 @@
0.0.4
0.1.0

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:

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:

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:

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:

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:

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:

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

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:

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:

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:

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:

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:

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:

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') %}
php54:
php_from_ppa:
pkgrepo.managed:
- ppa: {{ ppa_name }}
- ppa: {{ external_repo_name }}
- env:
- LC_ALL: "C.UTF-8"
- require_in:
- pkg: php_from_ppa
pkg.latest:
- name: php5
- name: {{ php.php_pkg }}
- refresh: True
{% endif %}
{% endif %}
{%- endif %}
{%- endif %}
php:
pkg.installed:
- name: {{ php.php_pkg }}
{% endif %}
{%- endif %}

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:

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:

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:

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:

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']({
{%- 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': {
'php_pkg': 'php',
'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')) %}
{%- 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',
'oauth_pkg': 'php-oauth',
'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',
'redis_pkg': 'php-redis',
'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',
'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',
'zip_pkg': 'php-zip',
}
}, grain="os"
, merge=salt['pillar.get']('php:lookup')) %}
{% else %}
{% set php = salt['grains.filter_by']({
}, grain="os", merge=salt['pillar.get']('php:lookup')) %}
{%- else %}
{# All other Ubuntu PHP definitions #}
{%- set php = salt['grains.filter_by']({
'Ubuntu': {
'php_pkg': 'php5',
'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',
'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': 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',
'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',
},
}, 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 %}
{%- 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',
'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',
'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-xmlreader','php5-xmlwriter','php5-xmlrpc'],
'zip_pkg': 'php5-zip',
},
}, merge=salt['pillar.get']('php:lookup')) %}
{% endif %}
{% endif %}
{%- endif %}

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:

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:

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:

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:

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 }}
- defaults: True
{%- if version is not none %}
- version: {{ version }}
{%- endif %}
- require:
- pkg: {{ php.pear_pkg }}
- defaults: True
{% if version is not none %}
- version: {{ version }}
{% endif %}
- 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 %}

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:

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:

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 %}

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 %}

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

View File

@ -1,2 +0,0 @@
{% set state = 'ffmpeg' %}
{% include "php/ng/installed.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={}) %}

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 = [] %}
@ -21,23 +24,20 @@
{% 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 %}
{% 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 }}
- 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:
@ -46,6 +46,17 @@ php_ppa_{{ state }}:
- 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 %}

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 = [] -%}

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,9 @@
{% 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 %}

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 %}

View File

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

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 %}

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:

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:

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:

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:

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:

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:

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:

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 %}

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:

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:

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"