Description
This role installs and configures the FastCGI Process Manager of PHP.
Requirements
Variables
-
php_fpm_config_file
- description:
- This option specifies the configuration file to be installed.
- default: "php-fpm.conf.j2"
- description:
-
php_fpm_pid_file
- description:
- This option specifies the PID File.
- default: ""
- description:
-
php_fpm_log
- description:
- This option is a dictionary with logging settings.
- keys:
-
error_log
- description:
- Name of the file where script errors should be logged.
- The special value syslog is used, the errors are sent to the system logger instead.
- default: "/var/log/php-fpm.log"
- description:
-
log_facility
- description:
- This option specifies the type of program for logging.
- default: "daemon"
- description:
-
log_ident
- description:
- This option is prepended to every log message.
- default: php-fpm
- description:
-
log_level
- description:
- This option specifes the log level.
- choices: ["alert", "error", "warning", "notice", "debug"]
- default: "notice"
- description:
-
log_limit
- description:
- This option specifies the number of characters in the single line (log entry).
- default: 4096
- description:
-
log_buffering
- description:
- This option specifies if the log line is buffered which means that the line is written in a single write operation.
- If the value is
false
, then the data is written directly into the file descriptor.
- choices: [false, true]
- default: true
- description:
-
- description:
-
php_fpm_processes
- description:
- This option is a dictionary and specifies the settings for processes of the FPM.
- keys:
-
emergency_restart_threshold
- description:
- This option specifies the number of child processes exit with SIGSEGV or SIGBUS within the time interval then FPM will restart.
- A value of '0' means 'Off'.
- default: 0
- description:
-
emergency_restart_interval
- description:
- This option specifies the interval of time used to determine when a graceful restart will be initiated.
- The value can have following units: s(econds), m(inutes), h(ours), or d(ays).
- default: "0s"
- description:
-
process_control_timeout
- description:
- This option specifes the time limit for child processes to wait for a reaction on signals from master.
- The value can have following units: s(econds), m(inutes), h(ours), or d(ays).
- default: "0s"
- description:
-
max_processes
- description:
- This option specifies the maximum number of processes FPM will fork.
- default: 128
- description:
-
process_priority
- description:
- This option specifies the nice priority to apply to the master process.
- default: 0
- description:
-
- description:
-
php_fpm_daemonize
- description:
- If this option is set to
true
, FPM is running in background.
- If this option is set to
- choices: [false, true]
- default: true
- description:
-
php_fpm_rlimit_files
- description:
- This option specifies the open file descriptor rlimit for the master process.
- default: 1024
- description:
-
php_fpm_rlimit_core
- description:
- This option specifies the maximum core size rlimit for the master process.
- default: 0
- description:
-
php_fpm_events_mechanism
- description:
- This option specify the event mechanism FPM will use.
- default: ""
- description:
-
php_fpm_systemd_interval
- description:
- When FPM is built with systemd integration, specify the interval, in seconds, between health report notification to systemd.
- default: 10
- description:
-
php_fpm_pools
- description:
- This option is a list of FPM pool settings named by variable _php_fpm_pool.
- description:
-
_php_fpm_pool
- description:
- This option is a dictionary with the specific pool settings.
- It is generated by the configuration process of fpm pools.
- It is usable within template files for pools.
- keys:
-
name
- description:
- This option specifies the name of a pool.
- default: ""
- required: true
- description:
-
source
- description:
- This option specifies the source file of a pool
- default: "php-fpm-pool.conf.j2"
- description:
-
prefix
- description:
- This option specifies the path prefix of a pool.
- default: ""
- description:
-
user
- description:
- This option specifies the user for the fpm processes.
- default: {{ php_default_user }}
- description:
-
group
- description:
- This option specifies the user for the fpm processes.
- default: {{ php_default_group }}
- description:
-
listen
- description:
- This option is a dictionary with settings for accepting FastCGI requests.
- keys:
-
address
- description:
- This option contains the address on which to accept FastCGI requests.
- It can be a IPv4- or IPv6 address or unix socket path.
- default: "127.0.0.1:9000"
- description:
-
backlog
- description:
- This option specifies the listen(2) backlog.
- default: 511
- description:
-
owner
- description:
- This option specifies the owner for unix socket, if one is used.
- default: {{ _php_fpm_pool.user }}
- description:
-
group
- description:
- This option specifies the group for unix socket, if one is used.
- default: {{ _php_fpm_pool.group }}
- description:
-
mode
- description:
- This option specifies the mode permission for unix socket, if one is used.
- default: 0660
- description:
-
acl_users
- description:
- This option specifies the comma separated list of users, when POSIX Access Control Lists are supported.
- default: ""
- description:
-
acl_groups
- description:
- This option specifies the comma separated list of groups, when POSIX Access Control Lists are supported.
- default: ""
- description:
-
allowed_clients
- description:
- This option contains a comma separated list of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
- default: "127.0.0.1"
- description:
-
- description:
-
process_priority
- description:
- This option specifies the pool process priority.
- default: 0
- description:
-
process_dumpable
- description:
- This option allows to create process core dump and ptrace the process for the pool user.
- choices: [false, true]
- default: false
- description:
-
pm
- description:
- This option is a dictionary with settings for the process managment of child processes.
- keys:
-
control
- description:
- This option specifies how the process manager will control the number of child processes.
- choices: [dynamic, ondemand, static]
- default: dynamic
- description:
-
max_children
- description:
- This option specifies the maximum number of child processes to be created.
- default: 5
- description:
-
start_servers
- description:
- This option specifies the number of child processes created on startup.
- default: 2
- description:
-
min_spare_servers
- description:
- This option specifies the desired minimum number of idle server processes.
- default: 1
- description:
-
max_spare_servers
- description:
- This option specifies the desired maximum number of idle server processes.
- default: 3
- description:
-
process_idle_timeout
- description:
- This option specifies the number of seconds after which an idle process will be killed.
- default: "10s"
- description:
-
max_requests
- description:
- This option specifies the number of requests each child process should execute before respawning.
- default: 0
- description:
-
status_path
- description:
- This option contains the URI to view the FPM status page.
- default: ""
- description:
-
status_listen
- description:
- This option contains the address on which to accept FastCGI status request.
- default: 127.0.0.1:9001
- description:
-
- description:
-
ping_path
- description:
- This option specifies the ping URI to call the monitoring page of FPM.
- default: ""
- description:
-
ping_response
- description:
- This option may be used to customize the response of a ping request.
- default: "pong"
- description:
-
access_log
- description:
- This option specifies the access log file.
- default: ""
- description:
-
access_format
- description:
- This option contains the access log format.
- default: "%R - %u %t "%m %r" %s"
- description:
-
slowlog:
- description:
- This option contains a log file for slow requests.
- default: ""
- description:
-
request_slowlog_timeout
- description:
- This option specifies the timeout for serving a single request after which a PHP backtrace will be dumped to the 'slowlog' file.
- A value of '0s' means 'off'.
- default: 0
- description:
-
request_slowlog_trace_depth
- description:
- This option specifies the depth of slow log stack trace.
- default: 20
- description:
-
request_terminate_timeout
- description:
- This option specifies the timeout for serving a single request after which the worker process will be killed.
- A value of '0s' means 'off'.
- default: 0
- description:
-
request_terminate_timeout_track_finished
- description:
- The timeout set by 'request_terminate_timeout' ini option is not engaged after application calls 'fastcgi_finish_request' or when application has finished and shutdown functions are being called.
- This option will enable timeout limit to be applied unconditionally even in such cases.
- choices: [false, true]
- default: false
- description:
-
rlimit_files
- description:
- This option sets open file descriptor rlimit.
- default: system defined value
- description:
-
rlimit_core
- description:
- This option sets max core size rlimit.
- default: system defined value
- description:
-
chroot
- description:
- This option specifies the directory to which chroot changes on start-up.
- default: ""
- description:
-
chdir
- description:
- This option specifies the directory to which chdir changes on start-up.
- default: current directory or / when chroot
- description:
-
catch_workers_output
- description:
- This option enables the redirection of worker stdout and stderr into main error log.
- choices: [false, true]
- default: false
- description:
-
decorate_workers_output
- description:
- This option enables the decoration of worker output with prefix and suffix containing information about the child that writes to the log and if stdout or stderr is used as well as log level and time.
- choices: [false, true]
- default: false
- description:
-
clear_env
- description:
- This option enables a clear environment in FPM workers.
- choices: [false, true]
- default: true
- description:
-
limit_extensions
- description:
- This option limits the extensions of the main script FPM will allow to parse.
- It is a space separated list.
- default: ".php"
- description:
-
environment
- description:
- This option is a dictionary of environment variables to be passed.
- The key is the environment variable, the value is the content of variable.
- default: {}
- description:
-
php_settings
- description:
- This option is a dictionary of PHP settings which can be overwritten from PHP call 'ini_set'.
- The key is the setting, the value is the content of setting.
- default: {}
- description:
-
php_admin_settings
- description:
- This option is a dictionary of PHP settings which can not be overwritten from PHP call 'ini_set'.
- The key is the setting, the value is the content of setting.
- default: {}
- description:
-
- description:
Processes
configure
- add additional path for configuration cloning.
- invoke inherited tasks
- configure PHP FPM
- configure PHP FPM pools
License
BSD-3-Clause
Contributors
- Martin Pietsch <martin.pietsch@tu-dresden.de>