swcc.php-fpm
php-fpm
This role installs and sets up the php-fpm interpreter.
Important Notice
RedHat support has ended in version 2.0.0. We welcome pull requests!
Requirements
You need Ansible version 1.4 or higher. Supported platforms are detailed in the metadata file.
Role Variables
This role uses the following variables:
php_fpm_version: The PHP version to install (options: 5.5, 5.6, 7.0, 7.1; default is 5.6). Note: PHP 5.5 is outdated and should be avoided.
php_fpm_pools: A list of php-fpm pools. Each pool has a name (used for the filename) and other settings (see PHP manual). One level of nested dictionaries is supported for environment variables and PHP settings.
php_fpm_pool_defaults: Default settings for all php-fpm pools (see PHP manual).
php_fpm_apt_packages: Packages to install with the
apt
module (default:[php5-fpm]
).php_fpm_yum_packages: Packages to install with the
yum
module (default:[php-fpm]
).php_fpm_ini: Custom settings for php-fpm's php.ini, provided as a list of options.
php_fpm_config: Custom settings for php-fpm's configuration file.
php_fpm_default_pool:
- delete: Set to
True
to delete the default pool. - name: The filename for the default pool configuration.
- delete: Set to
php_fpm_apt_latest: If set to
yes
, will update packages to the latest version.
Example Configuration
- role: php-fpm
php_fpm_pool_defaults:
pm: dynamic
pm.max_children: 5
pm.start_servers: 2
pm.min_spare_servers: 1
pm.max_spare_servers: 3
php_fpm_pools:
- name: foo
user: www-data
group: www-data
listen: 8000
chdir: /
- name: bar
user: www-data
group: www-data
listen: 8001
env:
PATH: "/usr/local/bin:/usr/bin:/bin"
TMPDIR: "/tmp"
php_admin_value:
sendmail_path: "/usr/sbin/sendmail -t -i -f [email protected]"
error_log: "/var/log/fpm-bar.www.log"
php_fpm_ini:
# PHP section settings
- option: "engine"
section: "PHP"
value: "1"
- option: "error_reporting"
section: "PHP"
value: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
- option: "date.timezone"
section: "PHP"
value: "Europe/Berlin"
# soap section settings
- option: "soap.wsdl_cache_dir"
section: "soap"
value: "/tmp"
# Pdo_mysql section settings
- option: "pdo_mysql.cache_size"
section: "Pdo_mysql"
value: "2000"
php_fpm_config:
- option: "log_level"
section: "global"
value: "notice"
- option: "syslog.facility"
section: "global"
value: "daemon"
Example Usage
---
# file: task.yml
- hosts: all
roles:
- nbz4live.php-fpm
- {
role: nbz4live.php-fpm,
php_fpm_pools:[
{name: foo, user: www-data, group: www-data, listen: 8000, chdir: /}
]
}
- role: php-fpm
php_fpm_pools:
- name: bar
user: www-data
group: www-data
listen: 9000
chdir: /
Important
The default process manager settings (pm, pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers) are for testing only. Always calculate these values based on your server resources. Read the documentation or follow this guide for the best settings.
License
BSD
Author
- Sergey Fayngold sergey@faynhost.com
- Pierre Buyle buyle@floedesign.ca
ansible-galaxy install swcc.php-fpm