Merge pull request #14 from spsoit/master
Adds NG states to php-formula
This commit is contained in:
commit
feb3c03e54
13
CHANGELOG.rst
Normal file
13
CHANGELOG.rst
Normal file
@ -0,0 +1,13 @@
|
||||
===========
|
||||
php-formula
|
||||
===========
|
||||
|
||||
0.2.0
|
||||
-----
|
||||
|
||||
- Added .ng states
|
||||
|
||||
0.1.0
|
||||
-----
|
||||
|
||||
- Initial version
|
193
README.rst
193
README.rst
@ -26,17 +26,17 @@ Installs the php package.
|
||||
Installs the php-apc package.
|
||||
|
||||
``php.adodb``
|
||||
------------
|
||||
-------------
|
||||
|
||||
Installs the php-adodb package.
|
||||
|
||||
``php.cgi``
|
||||
------------
|
||||
-----------
|
||||
|
||||
Installs the php-cgi package.
|
||||
|
||||
``php.cli``
|
||||
------------
|
||||
-----------
|
||||
|
||||
Installs the php-cli package.
|
||||
|
||||
@ -59,7 +59,7 @@ Installs the php-gd package.
|
||||
|
||||
|
||||
``php.imagick``
|
||||
------------
|
||||
---------------
|
||||
|
||||
Installs the php-imagick package.
|
||||
|
||||
@ -79,7 +79,7 @@ Installs the php-json package.
|
||||
Installs the php-ldap package.
|
||||
|
||||
``php.mbstring``
|
||||
---------------
|
||||
----------------
|
||||
|
||||
Installs the php-mbstring package.
|
||||
|
||||
@ -90,12 +90,12 @@ Installs the php-mcrypt package.
|
||||
|
||||
|
||||
``php.memcache``
|
||||
------------
|
||||
----------------
|
||||
|
||||
Installs the php-memcache package.
|
||||
|
||||
``php.memcached``
|
||||
------------
|
||||
-----------------
|
||||
|
||||
Installs the php-memcached package.
|
||||
|
||||
@ -105,7 +105,7 @@ Installs the php-memcached package.
|
||||
Installs the php-mysql package.
|
||||
|
||||
``php.mysqlnd``
|
||||
------------
|
||||
---------------
|
||||
|
||||
Installs the php-mysqlnd package.
|
||||
|
||||
@ -115,7 +115,7 @@ Installs the php-mysqlnd package.
|
||||
Installs the php-pear package.
|
||||
|
||||
``php.pgsql``
|
||||
------------
|
||||
-------------
|
||||
|
||||
Installs the php-pgsql package.
|
||||
|
||||
@ -125,11 +125,182 @@ Installs the php-pgsql package.
|
||||
Installs the php-soap package.
|
||||
|
||||
``php.suhosin``
|
||||
------------
|
||||
---------------
|
||||
|
||||
Installs the php-suhosin package.
|
||||
|
||||
``php.xml``
|
||||
------------
|
||||
-----------
|
||||
|
||||
Installs the php-xml package.
|
||||
|
||||
Next-generation, alternate approach
|
||||
===================================
|
||||
|
||||
The following states provide an alternate approach to managing PHP and FPM
|
||||
pools, as well as code organization. Please provide feedback by filing issues,
|
||||
discussing in ``#salt`` in Freenode and the mailing list as normal.
|
||||
|
||||
**Note:** php.ng states require the merge parameter of salt.modules.pillar.get(),
|
||||
first available in the Helium release.
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
``php.ng``
|
||||
----------
|
||||
|
||||
Installs the php package.
|
||||
|
||||
``php.ng.adodb``
|
||||
----------------
|
||||
|
||||
Installs the php-adodb package.
|
||||
|
||||
``php.ng.apc``
|
||||
--------------
|
||||
|
||||
Installs the php-apc package.
|
||||
|
||||
``php.ng.cgi``
|
||||
--------------
|
||||
|
||||
Installs the php-cgi package.
|
||||
|
||||
``php.ng.cli``
|
||||
--------------
|
||||
|
||||
Meta-state that combines `php.ng.cli.install`_ and `php.ng.cli.ini`_.
|
||||
|
||||
``php.ng.cli.install``
|
||||
----------------------
|
||||
|
||||
Installs the php-cli package.
|
||||
|
||||
``php.ng.cli.ini``
|
||||
------------------
|
||||
|
||||
Manages the php-cli ini file.
|
||||
|
||||
``php.ng.curl``
|
||||
---------------
|
||||
|
||||
Installs the php5-curl package on Debian, and ensures that curl itself is
|
||||
installed for RedHat systems, this is due to the curl libs being provided by
|
||||
php-common, which will get installed with the main php package.
|
||||
|
||||
``php.ng.fpm``
|
||||
--------------
|
||||
|
||||
Meta-state that combines all php.ng.fpm states.
|
||||
|
||||
``php.ng.fpm.config``
|
||||
---------------------
|
||||
|
||||
Manages the (non-pool) php-fpm config files.
|
||||
|
||||
|
||||
``php.ng.fpm.install``
|
||||
----------------------
|
||||
|
||||
Installs the php-fpm package.
|
||||
|
||||
|
||||
``php.ng.fpm.pools``
|
||||
--------------------
|
||||
|
||||
Meta-state that combines `php.ng.fpm.service`_ and `php.ng.fpm.pools_config`_
|
||||
|
||||
|
||||
``php.ng.fpm.pools_config``
|
||||
---------------------------
|
||||
|
||||
Manages php-fpm pool config files.
|
||||
|
||||
|
||||
``php.ng.fpm.service``
|
||||
----------------------
|
||||
|
||||
Manages the php-fpm service.
|
||||
|
||||
``php.ng.gd``
|
||||
-------------
|
||||
|
||||
Installs the php-gd package.
|
||||
|
||||
|
||||
``php.ng.imagick``
|
||||
------------------
|
||||
|
||||
Installs the php-imagick package.
|
||||
|
||||
``php.ng.imap``
|
||||
---------------
|
||||
|
||||
Installs the php-imap package.
|
||||
|
||||
``php.ng.json``
|
||||
---------------
|
||||
|
||||
Installs the php-json package.
|
||||
|
||||
``php.ng.ldap``
|
||||
---------------
|
||||
|
||||
Installs the php-ldap package.
|
||||
|
||||
``php.ng.mbstring``
|
||||
-------------------
|
||||
|
||||
Installs the php-mbstring package.
|
||||
|
||||
``php.ng.mcrypt``
|
||||
-----------------
|
||||
|
||||
Installs the php-mcrypt package.
|
||||
|
||||
|
||||
``php.ng.memcache``
|
||||
-------------------
|
||||
|
||||
Installs the php-memcache package.
|
||||
|
||||
``php.ng.memcached``
|
||||
--------------------
|
||||
|
||||
Installs the php-memcached package.
|
||||
|
||||
``php.ng.mysql``
|
||||
----------------
|
||||
|
||||
Installs the php-mysql package.
|
||||
|
||||
``php.ng.mysqlnd``
|
||||
------------------
|
||||
|
||||
Installs the php-mysqlnd package.
|
||||
|
||||
``php.ng.pear``
|
||||
---------------
|
||||
|
||||
Installs the php-pear package.
|
||||
|
||||
``php.ng.pgsql``
|
||||
----------------
|
||||
|
||||
Installs the php-pgsql package.
|
||||
|
||||
``php.ng.soap``
|
||||
---------------
|
||||
|
||||
Installs the php-soap package.
|
||||
|
||||
``php.ng.suhosin``
|
||||
------------------
|
||||
|
||||
Installs the php-suhosin package.
|
||||
|
||||
``php.ng.xml``
|
||||
--------------
|
||||
|
||||
Installs the php-xml package.
|
@ -24,6 +24,7 @@
|
||||
'adodb_pkg': 'php5-adodb',
|
||||
'pgsql_pkg': 'php5-pgsql',
|
||||
'ldap_pkg': 'php5-ldap',
|
||||
'php_ini': '/etc/php5/apache2/php.ini',
|
||||
},
|
||||
'RedHat': {
|
||||
'php_pkg': 'php',
|
||||
@ -50,5 +51,6 @@
|
||||
'adodb_pkg': 'php-adodb',
|
||||
'pgsql_pkg': 'php-pgsql',
|
||||
'ldap_pkg': 'php-ldap',
|
||||
'php_ini': '/etc/php.ini',
|
||||
},
|
||||
}, merge=salt['pillar.get']('php:lookup')) %}
|
||||
|
2
php/ng/adodb.sls
Normal file
2
php/ng/adodb.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'adodb' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/apc.sls
Normal file
2
php/ng/apc.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'apc' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/cgi.sls
Normal file
2
php/ng/cgi.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'cgi' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
9
php/ng/cli/ini.sls
Normal file
9
php/ng/cli/ini.sls
Normal file
@ -0,0 +1,9 @@
|
||||
# Manages the php cli main ini file
|
||||
{% from 'php/ng/map.jinja' import php with context %}
|
||||
{% from "php/ng/ini.jinja" import php_ini %}
|
||||
|
||||
{% set settings = php.ini.defaults %}
|
||||
{% do settings.update(php.cli.ini.settings) %}
|
||||
|
||||
php_cli_ini:
|
||||
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
|
11
php/ng/cli/init.sls
Normal file
11
php/ng/cli/init.sls
Normal file
@ -0,0 +1,11 @@
|
||||
# Installs php-cli and manages the associated php.ini
|
||||
|
||||
include:
|
||||
- php.ng.cli.install
|
||||
- php.ng.cli.ini
|
||||
|
||||
extend:
|
||||
php_cli_ini:
|
||||
file:
|
||||
- require:
|
||||
- sls: php.ng.cli.install
|
2
php/ng/cli/install.sls
Normal file
2
php/ng/cli/install.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'cli' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/curl.sls
Normal file
2
php/ng/curl.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'curl' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
31
php/ng/files/php.ini
Normal file
31
php/ng/files/php.ini
Normal file
@ -0,0 +1,31 @@
|
||||
{%- macro php_block(config) %}
|
||||
{% for sections in config %}
|
||||
{%- for section, settings in sections.items() -%}
|
||||
{%- if settings is number or settings is string %}
|
||||
{{ section }} = {{ settings }}
|
||||
{%- else %}
|
||||
[{{ section }}]
|
||||
{%- for setting in settings -%}
|
||||
{%- for key, value in setting.items() %}
|
||||
{%- if value is number or value is string %}
|
||||
{{ key }} = {{ value }}
|
||||
{%- elif value is iterable -%}
|
||||
{%- if key == 'error_reporting' %}
|
||||
{{ key }} = {{ value|join(" & ") }}
|
||||
{%- else %}
|
||||
{{ key }} = {{ value|join(",") }}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{% endfor %}
|
||||
{%- endmacro -%}
|
||||
|
||||
; PHP configuration file.
|
||||
;
|
||||
; **** DO NOT EDIT THIS FILE ****
|
||||
;
|
||||
; This file is managed by Salt via {{ source }}
|
||||
{{ php_block(config) }}
|
15
php/ng/fpm/config.sls
Normal file
15
php/ng/fpm/config.sls
Normal file
@ -0,0 +1,15 @@
|
||||
# Manages the php-fpm main ini file
|
||||
{% from 'php/ng/map.jinja' import php with context %}
|
||||
{% from "php/ng/ini.jinja" import php_ini %}
|
||||
|
||||
{% set ini_settings = php.ini.defaults %}
|
||||
{% do ini_settings.update(php.fpm.config.ini.settings) %}
|
||||
|
||||
{% set conf_settings = php.lookup.fpm.defaults %}
|
||||
{% do conf_settings.update(php.fpm.config.conf.settings) %}
|
||||
|
||||
php_fpm_ini_config:
|
||||
{{ php_ini(php.lookup.fpm.ini, php.fpm.config.ini.opts, ini_settings) }}
|
||||
|
||||
php_fpm_conf_config:
|
||||
{{ php_ini(php.lookup.fpm.conf, php.fpm.config.conf.opts, conf_settings) }}
|
15
php/ng/fpm/init.sls
Normal file
15
php/ng/fpm/init.sls
Normal file
@ -0,0 +1,15 @@
|
||||
# Meta-state to fully install php.fpm
|
||||
|
||||
include:
|
||||
- php.ng.fpm.config
|
||||
- php.ng.fpm.service
|
||||
- php.ng.fpm.pools
|
||||
|
||||
extend:
|
||||
php_fpm_service:
|
||||
service:
|
||||
- watch:
|
||||
- file: php_fpm_ini_config
|
||||
- file: php_fpm_conf_config
|
||||
- require:
|
||||
- sls: php.ng.fpm.config
|
2
php/ng/fpm/install.sls
Normal file
2
php/ng/fpm/install.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'fpm' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
22
php/ng/fpm/pools.sls
Normal file
22
php/ng/fpm/pools.sls
Normal file
@ -0,0 +1,22 @@
|
||||
# Manages the php-fpm pools config files
|
||||
{% from "php/ng/map.jinja" import php with context %}
|
||||
{% from "php/ng/macro.jinja" import sls_block %}
|
||||
{% from "php/ng/fpm/pools_config.sls" import pool_states with context %}
|
||||
|
||||
{% macro file_requisites(states) %}
|
||||
{%- for state in states %}
|
||||
- file: {{ state }}
|
||||
{%- endfor -%}
|
||||
{% endmacro %}
|
||||
|
||||
include:
|
||||
- php.ng.fpm.service
|
||||
- php.ng.fpm.pools_config
|
||||
|
||||
extend:
|
||||
php_fpm_service:
|
||||
service:
|
||||
- watch:
|
||||
{{ file_requisites(pool_states) }}
|
||||
- require:
|
||||
{{ file_requisites(pool_states) }}
|
34
php/ng/fpm/pools_config.sls
Normal file
34
php/ng/fpm/pools_config.sls
Normal file
@ -0,0 +1,34 @@
|
||||
# Manages the php-fpm pools config files
|
||||
{% from 'php/ng/map.jinja' import php with context %}
|
||||
{% from "php/ng/macro.jinja" import sls_block, serialize %}
|
||||
|
||||
# Simple path concatenation.
|
||||
{% macro path_join(file, root) -%}
|
||||
{{ root ~ '/' ~ file }}
|
||||
{%- endmacro %}
|
||||
|
||||
{% set pool_states = [] %}
|
||||
|
||||
{% for pool, config in php.fpm.pools.items() %}
|
||||
{% set state = 'php_fpm_pool_conf_' ~ loop.index0 %}
|
||||
{% set fpath = path_join(pool, php.lookup.fpm.pools) %}
|
||||
|
||||
{{ state }}:
|
||||
{% if config.enabled %}
|
||||
file.managed:
|
||||
{{ sls_block(config.get('opts', {})) }}
|
||||
- name: {{ fpath }}
|
||||
- source: salt://php/ng/files/php.ini
|
||||
- template: jinja
|
||||
- context:
|
||||
config: {{ serialize(config.get('settings', {})) }}
|
||||
{% else %}
|
||||
file.absent:
|
||||
- name: {{ fpath }}
|
||||
{% endif %}
|
||||
|
||||
{% do pool_states.append(state) %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
18
php/ng/fpm/service.sls
Normal file
18
php/ng/fpm/service.sls
Normal file
@ -0,0 +1,18 @@
|
||||
# Manages the php-fpm service.
|
||||
{% from "php/ng/map.jinja" import php with context %}
|
||||
{% from "php/ng/macro.jinja" import sls_block %}
|
||||
|
||||
{% set service_function = {True:'running', False:'dead'}.get(php.fpm.service.enabled) %}
|
||||
|
||||
include:
|
||||
- php.ng.fpm.install
|
||||
|
||||
php_fpm_service:
|
||||
service.{{ service_function }}:
|
||||
{{ sls_block(php.fpm.service.opts) }}
|
||||
- name: {{ php.lookup.fpm.service }}
|
||||
- enable: {{ php.fpm.service.enabled }}
|
||||
- require:
|
||||
- sls: php.ng.fpm.install
|
||||
- watch:
|
||||
- pkg: php_install_fpm
|
2
php/ng/gd.sls
Normal file
2
php/ng/gd.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'gd' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/imagick.sls
Normal file
2
php/ng/imagick.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'imagick' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/imap.sls
Normal file
2
php/ng/imap.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'imap' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
12
php/ng/ini.jinja
Normal file
12
php/ng/ini.jinja
Normal file
@ -0,0 +1,12 @@
|
||||
# php.ini management macro.
|
||||
{% from "php/ng/macro.jinja" import sls_block, serialize %}
|
||||
|
||||
{% macro php_ini(filename, opts={}, settings={}) %}
|
||||
file.managed:
|
||||
{{ sls_block(opts) }}
|
||||
- name: {{ filename }}
|
||||
- source: salt://php/ng/files/php.ini
|
||||
- template: jinja
|
||||
- context:
|
||||
config: {{ serialize(settings) }}
|
||||
{%- endmacro -%}
|
2
php/ng/init.sls
Normal file
2
php/ng/init.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'php' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
34
php/ng/installed.jinja
Normal file
34
php/ng/installed.jinja
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 pkgs = [] %}
|
||||
{% set specials = [] %}
|
||||
|
||||
{% if pkginfo is iterable and pkginfo is not string %}
|
||||
{% for pkg in pkginfo %}
|
||||
{% if pkg is mapping %}
|
||||
{% do specials.append(pkg) %}
|
||||
{% else %}
|
||||
{% do pkgs.append(pkg) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% do pkgs.append(pkginfo) %}
|
||||
{% endif %}
|
||||
|
||||
php_install_{{ state }}:
|
||||
pkg.installed:
|
||||
- name: {{ state }}
|
||||
- pkgs: {{ pkgs|json() }}
|
||||
|
||||
{% for pkg in specials %}
|
||||
|
||||
php_install_{{ state }}_{{ pkg.get('name') }}:
|
||||
pkg.installed:
|
||||
{{ sls_block(pkg) }}
|
||||
|
||||
{% endfor %}
|
2
php/ng/json.sls
Normal file
2
php/ng/json.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'json' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/ldap.sls
Normal file
2
php/ng/ldap.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'ldap' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
27
php/ng/macro.jinja
Normal file
27
php/ng/macro.jinja
Normal file
@ -0,0 +1,27 @@
|
||||
# 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
|
||||
{%- macro serialize(data) -%}
|
||||
{%- if data is mapping -%}
|
||||
{%- set ret = [] -%}
|
||||
{%- for key, value in data.items() -%}
|
||||
{%- set value = serialize(value)|load_json() -%}
|
||||
{%- do ret.append({key: value}) -%}
|
||||
{%- endfor -%}
|
||||
{%- elif data is iterable and data is not string -%}
|
||||
{%- set ret = [] -%}
|
||||
{%- for value in data -%}
|
||||
{%- set value = serialize(value)|load_json() -%}
|
||||
{%- do ret.append(value) -%}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
{% set ret = data %}
|
||||
{%- endif -%}
|
||||
|
||||
{{ ret|json() }}
|
||||
{%- endmacro -%}
|
274
php/ng/map.jinja
Normal file
274
php/ng/map.jinja
Normal file
@ -0,0 +1,274 @@
|
||||
{% set php = salt['pillar.get']('php:ng', {
|
||||
'lookup': salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'pkgs': {
|
||||
'php': 'php5',
|
||||
'apc': 'php-apc',
|
||||
'cgi': 'php5-cgi',
|
||||
'cli': 'php5-cli',
|
||||
'curl': 'php5-curl',
|
||||
'fpm': 'php5-fpm',
|
||||
'gd': 'php5-gd',
|
||||
'mbstring': 'php5',
|
||||
'mcrypt': 'php5-mcrypt',
|
||||
'memcache': 'php5-memcache',
|
||||
'memcached': 'php5-memcached',
|
||||
'mysql': 'php5-mysql',
|
||||
'mysqlnd': 'php5-mysqlnd',
|
||||
'pear': ' php-pear',
|
||||
'soap': ' php-soap',
|
||||
'xml': ' php5-xml',
|
||||
'imagick': 'php5-imagick',
|
||||
'suhosin': 'php5-suhosin',
|
||||
'imap': 'php5-imap',
|
||||
'adodb': 'php5-adodb',
|
||||
'pgsql': 'php5-pgsql',
|
||||
'ldap': 'php5-ldap',
|
||||
'json': 'php5-json',
|
||||
},
|
||||
'fpm': {
|
||||
'conf': '/etc/php5/fpm/php-fpm.conf',
|
||||
'ini': '/etc/php5/fpm/php.ini',
|
||||
'pools': '/etc/php5/fpm/pool.d',
|
||||
'service': 'php5-fpm',
|
||||
'defaults': odict([
|
||||
('global', odict([
|
||||
('pid', '/var/run/php5-fpm.pid'),
|
||||
('error_log', '/var/log/php5-fpm.log'),
|
||||
('include', '/etc/php5/fpm/pool.d/*.conf'),
|
||||
])),
|
||||
]),
|
||||
},
|
||||
'cli': {
|
||||
'ini': '/etc/php5/cli/php.ini',
|
||||
},
|
||||
},
|
||||
'RedHat': {
|
||||
'pkgs': {
|
||||
'php': 'php',
|
||||
'apc': 'php-pecl-apc',
|
||||
'cgi': 'php-cgi',
|
||||
'cli': 'php-cli',
|
||||
'curl': ['php-common', 'curl'],
|
||||
'fpm': 'php-fpm',
|
||||
'gd': 'php-gd',
|
||||
'mbstring': 'php-mbstring',
|
||||
'mcrypt': 'php-mcrypt',
|
||||
'memcache': 'php-pecl-memcache',
|
||||
'memcached': 'php-pecl-memcached',
|
||||
'mysql': 'php-mysql',
|
||||
'mysqlnd': 'php-mysqlnd',
|
||||
'pear': ' php-pear',
|
||||
'soap': ' php-soap',
|
||||
'xml': ' php-xml',
|
||||
'imagick': 'php-imagick',
|
||||
'suhosin': 'php-suhosin',
|
||||
'imap': 'php-imap',
|
||||
'adodb': 'php-adodb',
|
||||
'pgsql': 'php-pgsql',
|
||||
'ldap': 'php-ldap',
|
||||
'json': 'php-common',
|
||||
},
|
||||
'fpm': {
|
||||
'conf': '/etc/php-fpm.conf',
|
||||
'ini': '/etc/php.ini',
|
||||
'pools': '/etc/php-fpm.d',
|
||||
'service': 'php-fpm',
|
||||
'defaults': {
|
||||
'global': {
|
||||
'pid': '/var/run/php-fpm/php-fpm.pid',
|
||||
'error_log': '/var/log/php-fpm/error.log',
|
||||
'include': '/etc/php-fpm.d/*.conf',
|
||||
},
|
||||
},
|
||||
},
|
||||
'cli': {
|
||||
'ini': '/etc/php.ini',
|
||||
},
|
||||
},
|
||||
}),
|
||||
'fpm': {
|
||||
'service': {
|
||||
'enabled': True,
|
||||
'opts': {},
|
||||
},
|
||||
'config': {
|
||||
'ini': {
|
||||
'opts': {},
|
||||
'settings': {},
|
||||
},
|
||||
'conf': {
|
||||
'opts': {},
|
||||
'settings': {},
|
||||
},
|
||||
},
|
||||
'pools': {},
|
||||
},
|
||||
'cli': {
|
||||
'ini': {
|
||||
'opts': {},
|
||||
'settings': {},
|
||||
}
|
||||
},
|
||||
'ini': {
|
||||
'defaults': {
|
||||
'PHP': {
|
||||
'engine': 'On',
|
||||
'short_open_tag': 'Off',
|
||||
'asp_tags': 'Off',
|
||||
'precision': 14,
|
||||
'output_buffering': 4096,
|
||||
'zlib.output_compression': 'Off',
|
||||
'implicit_flush': 'Off',
|
||||
'serialize_precision': 17,
|
||||
'disable_functions': ['pcntl_alarm','pcntl_fork','pcntl_waitpid','pcntl_wait','pcntl_wifexited','pcntl_wifstopped','pcntl_wifsignaled',
|
||||
'pcntl_wexitstatus','pcntl_wtermsig','pcntl_wstopsig','pcntl_signal','pcntl_signal_dispatch','pcntl_get_last_error','pcntl_strerror',
|
||||
'pcntl_sigprocmask','pcntl_sigwaitinfo','pcntl_sigtimedwait','pcntl_exec','pcntl_getpriority','pcntl_setpriority'],
|
||||
'zend.enable_gc': 'On',
|
||||
'expose_php': 'On',
|
||||
'max_execution_time': 30,
|
||||
'max_input_time': 60,
|
||||
'max_input_nesting_level': 64,
|
||||
'max_input_vars': 1000,
|
||||
'memory_limit': '128M',
|
||||
'error_reporting': ['E_ALL', '~E_DEPRECATED', '~E_STRICT'],
|
||||
'display_errors': 'Off',
|
||||
'display_startup_errors': 'Off',
|
||||
'log_errors': 'On',
|
||||
'log_errors_max_len': 1024,
|
||||
'ignore_repeated_errors': 'Off',
|
||||
'ignore_repeated_source': 'Off',
|
||||
'report_memleaks': 'On',
|
||||
'track_errors': 'Off',
|
||||
'html_errors': 'On',
|
||||
'variables_order': 'GPCS',
|
||||
'request_order': 'GP',
|
||||
'register_argc_argv': 'Off',
|
||||
'auto_globals_jit': 'On',
|
||||
'post_max_size': '8M',
|
||||
'default_mimetype': '"text/html"',
|
||||
'enable_dl': 'Off',
|
||||
'file_uploads': 'On',
|
||||
'upload_max_filesize': '2M',
|
||||
'max_file_uploads': 20,
|
||||
'allow_url_fopen': 'On',
|
||||
'allow_url_include': 'Off',
|
||||
'default_socket_timeout': 60
|
||||
},
|
||||
'CLI Server': {
|
||||
'cli_server.color': 'On'
|
||||
},
|
||||
'Date': {
|
||||
'date.timezone': 'America/New_York'
|
||||
},
|
||||
'Pdo_mysql': {
|
||||
'pdo_mysql.cache_size': 2000
|
||||
},
|
||||
'mail function': {
|
||||
'SMTP': 'localhost',
|
||||
'mail.add_x_header': 'On'
|
||||
},
|
||||
'SQL': {
|
||||
'sql.safe_mode': 'Off'
|
||||
},
|
||||
'ODBC': {
|
||||
'odbc.allow_persistent': 'On',
|
||||
'odbc.check_persistent': 'On',
|
||||
'odbc.max_persistent': '-1',
|
||||
'odbc.max_links': '-1',
|
||||
'odbc.defaultlrl': 4096,
|
||||
'odbc.defaultbinmode': 1
|
||||
},
|
||||
'Interbase': {
|
||||
'ibase.allow_persistent': 1,
|
||||
'ibase.max_persistent': -1,
|
||||
'ibase.max_links': -1,
|
||||
'ibase.timestampformat': '"%Y-%m-%d %H:%M:%S"',
|
||||
'ibase.dateformat': '"%Y-%m-%d"',
|
||||
'ibase.timeformat': '"%H:%M:%S"'
|
||||
},
|
||||
'MySQL': {
|
||||
'mysql.allow_local_infile': 'On',
|
||||
'mysql.allow_persistent': 'On',
|
||||
'mysql.cache_size': '2000',
|
||||
'mysql.max_persistent': -1,
|
||||
'mysql.max_links': -1,
|
||||
'mysql.connect_timeout': 60,
|
||||
'mysql.trace_mode': 'Off'
|
||||
},
|
||||
'MySQLi': {
|
||||
'mysqli.max_persistent': -1,
|
||||
'mysqli.allow_persistent': 'On',
|
||||
'mysqli.max_links': -1,
|
||||
'mysqli.cache_size': 2000,
|
||||
'mysqli.default_port': 3306,
|
||||
'mysqli.reconnect': 'Off'
|
||||
},
|
||||
'mysqlnd': {
|
||||
'mysqlnd.collect_statistics': 'On',
|
||||
'mysqlnd.collect_memory_statistics': 'Off'
|
||||
},
|
||||
'PostgreSQL': {
|
||||
'pgsql.allow_persistent': 'On',
|
||||
'pgsql.auto_reset_persistent': 'Off',
|
||||
'pgsql.max_persistent': -1,
|
||||
'pgsql.max_links': -1,
|
||||
'pgsql.ignore_notice': 0,
|
||||
'pgsql.log_notice': 0
|
||||
},
|
||||
'Sybase-CT': {
|
||||
'sybct.allow_persistent': 'On',
|
||||
'sybct.max_persistent': -1,
|
||||
'sybct.max_links': -1,
|
||||
'sybct.min_server_severity': 10,
|
||||
'sybct.min_client_severity': 10
|
||||
},
|
||||
'bcmath': {
|
||||
'bcmath.scale': 0
|
||||
},
|
||||
'Session': {
|
||||
'session.save_handler': 'files',
|
||||
'session.use_strict_mode': 0,
|
||||
'session.use_cookies': 1,
|
||||
'session.use_only_cookies': 1,
|
||||
'session.name': 'PHPSESSID',
|
||||
'session.auto_start': 0,
|
||||
'session.cookie_lifetime': 0,
|
||||
'session.cookie_path': '/',
|
||||
'session.serialize_handler': 'php',
|
||||
'session.gc_probability': 0,
|
||||
'session.gc_divisor': 1000,
|
||||
'session.gc_maxlifetime': 1440,
|
||||
'session.bug_compat_42': 'Off',
|
||||
'session.bug_compat_warn': 'Off',
|
||||
'session.cache_limiter': 'nocache',
|
||||
'session.cache_expire': '180',
|
||||
'session.use_trans_sid': 0,
|
||||
'session.hash_function': 0,
|
||||
'session.hash_bits_per_character': 5,
|
||||
'url_rewriter.tags': '"a=href,area=href,frame=src,input=src,form=fakeentry"'
|
||||
},
|
||||
'MSSQL': {
|
||||
'mssql.allow_persistent': 'On',
|
||||
'mssql.max_persistent': -1,
|
||||
'mssql.max_links': -1,
|
||||
'mssql.min_error_severity': 10,
|
||||
'mssql.min_message_severity': 10,
|
||||
'mssql.compatibility_mode': 'Off',
|
||||
'mssql.secure_connection': 'Off'
|
||||
},
|
||||
'Tidy': {
|
||||
'tidy.clean_output': 'Off'
|
||||
},
|
||||
'soap': {
|
||||
'soap.wsdl_cache_enabled': 1,
|
||||
'soap.wsdl_cache_dir': '"/tmp"',
|
||||
'soap.wsdl_cache_ttl': 86400,
|
||||
'soap.wsdl_cache_limit': 5
|
||||
},
|
||||
'ldap': {
|
||||
'ldap.max_links': -1
|
||||
},
|
||||
},
|
||||
},
|
||||
}, merge=True) %}
|
2
php/ng/mbstring.sls
Normal file
2
php/ng/mbstring.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'mbstring' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/mcrypt.sls
Normal file
2
php/ng/mcrypt.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'mcrypt' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/memcache.sls
Normal file
2
php/ng/memcache.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'memcache' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/memcached.sls
Normal file
2
php/ng/memcached.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'memcached' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/mysql.sls
Normal file
2
php/ng/mysql.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'mysql' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/mysqlnd.sls
Normal file
2
php/ng/mysqlnd.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'mysqld' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/pear.sls
Normal file
2
php/ng/pear.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'pear' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/pgsql.sls
Normal file
2
php/ng/pgsql.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'pgsql' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/soap.sls
Normal file
2
php/ng/soap.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'soap' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/suhosin.sls
Normal file
2
php/ng/suhosin.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'suhosin' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
2
php/ng/xml.sls
Normal file
2
php/ng/xml.sls
Normal file
@ -0,0 +1,2 @@
|
||||
{% set state = 'xml' %}
|
||||
{% include "php/ng/installed.jinja" %}
|
140
pillar.example
140
pillar.example
@ -0,0 +1,140 @@
|
||||
## php.ng pillar examples
|
||||
|
||||
php:
|
||||
ng:
|
||||
# this section contains mostly grain filtered data, while overrides
|
||||
# are possible in the pillar for unique cases, if your OS is not
|
||||
# represented, please consider adding it to the map.jinja for
|
||||
# upstream inclusion
|
||||
lookup:
|
||||
|
||||
# package definitions, these can strings, lists of strings, or
|
||||
# lists of dictionaries
|
||||
pkgs:
|
||||
memcached: php5-memcached
|
||||
# ensures both will be installed
|
||||
curl:
|
||||
- php-common
|
||||
- curl
|
||||
# a dictionary can be used in more complex cases where you want
|
||||
# to pass forward special arguments to the pkg.installed call
|
||||
# you MUST include the name argument for this to work
|
||||
cli:
|
||||
-
|
||||
name: php-cli
|
||||
fromrepo: my-specialrepo
|
||||
-
|
||||
name: php-common
|
||||
skip_verify: True
|
||||
|
||||
# php-fpm os-specific settings
|
||||
fpm:
|
||||
conf: /location/of/php-fpm/config.conf
|
||||
ini: /location/of/php-fpm/php.ini
|
||||
pools: /location/of/php-fpm/pool.d
|
||||
service: name-of-php5-fpm-service
|
||||
|
||||
# the default content of the php5-fpm main config file
|
||||
defaults:
|
||||
global:
|
||||
pid: /var/run/php5-fpm.pid
|
||||
|
||||
# php-cli os-specific settings
|
||||
cli:
|
||||
ini: /location/of/php-cli/php.ini
|
||||
|
||||
# php-fpm settings
|
||||
fpm:
|
||||
|
||||
# settings for the php-fpm service
|
||||
service:
|
||||
# if True, enables the php-fpm service, if False disables it
|
||||
enabled: True
|
||||
# additional arguments passed forward to
|
||||
# service.enabled/disabled
|
||||
opts:
|
||||
reload: True
|
||||
|
||||
# settings for the relevant php-fpm configuration files
|
||||
config:
|
||||
|
||||
# options to manage the php.ini file used by php-fpm
|
||||
ini:
|
||||
# arguments passed through to file.managed
|
||||
opts:
|
||||
recurse: True
|
||||
# php.ini file contents that will be merged with the
|
||||
# defaults in php.ng.ini.defaults. See php.ng.ini.defaults for
|
||||
# syntax guidelines.
|
||||
settings:
|
||||
PHP:
|
||||
engine: 'Off'
|
||||
|
||||
# options to manage the php-fpm conf file
|
||||
conf:
|
||||
# arguments passed through to file.managed
|
||||
opts:
|
||||
recurse: True
|
||||
# php-fpm conf file contents that will be merged with
|
||||
# php.ng.lookup.fpm.defaults. See php.ng.ini.defaults for
|
||||
# ini-style syntax guidelines.
|
||||
settings:
|
||||
global:
|
||||
pid: /var/run/php-fpm/special-pid.file
|
||||
|
||||
# settings for fpm-pools
|
||||
pools:
|
||||
# name of the pool file to be managed, this will be appended
|
||||
# to the path specified in php.ng.lookup.fpm.pools
|
||||
'mypool.conf':
|
||||
# If true, the pool file will be managed, if False it will be
|
||||
# absent
|
||||
enabled: True
|
||||
# arguments passed forward to file.managed or file.absent
|
||||
opts:
|
||||
replace: False
|
||||
|
||||
# pool file contents. See php.ng.ini.defaults for ini-style
|
||||
# syntax guidelines.
|
||||
settings:
|
||||
myapp:
|
||||
user: www-data
|
||||
group: www-data
|
||||
listen: /var/run/php5-fpm-myapp.sock
|
||||
pm: dynamic
|
||||
pm.max_children: 5
|
||||
pm.start_servers: 2
|
||||
pm.min_spare_servers: 1
|
||||
pm.max_spare_servers: 3
|
||||
'php_admin_value[memory_limit]': 300M
|
||||
|
||||
# php-cli settings
|
||||
cli:
|
||||
# settings to manage the cli's php.ini
|
||||
ini:
|
||||
# opts passed forward directly to file.managed
|
||||
opts:
|
||||
replace: False
|
||||
# contents of the php.ini file that are merged with defaults
|
||||
# from php.ng.ini.defaults. See php.ng.ini.defaults for ini-style
|
||||
# syntax guidelines
|
||||
settings:
|
||||
PHP:
|
||||
engine: 'Off'
|
||||
|
||||
# global php.ini settings
|
||||
ini:
|
||||
# Default php.ini contents. These follow a strict format. The top-
|
||||
# level dict keys form ini group headings. Nested key/value
|
||||
# pairs represent setting=value statements. If a value is a list,
|
||||
# its contents will be joined by commas in final rendering.
|
||||
defaults:
|
||||
PHP:
|
||||
engine: on
|
||||
output_buffering: 4096
|
||||
disable_functions:
|
||||
- pcntl_alarm
|
||||
- pcntl_fork
|
||||
- pcntl_wait
|
||||
'CLI Server':
|
||||
cli_server_color: 'On'
|
Loading…
Reference in New Issue
Block a user