Skip to content

OSSHelp/ansible-phpfpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-fpm

Build Status

Role for Ansible, which installs php-fpm, php modules, generate configs from Ubuntu official repo or from ppa

Usage (example)

Common example

    - role: php-fpm
      phpfpm_modules:
        - bz2
        - mysql
      phpfpm_php_params:
        "output_buffering": "4096"
      phpfpm_pools:
        - name: test1
          user: nobody
          group: nogroup
          request_slowlog_timeout: 2
          php_params:
            - {name: sendmail_path, value: '/usr/sbin/sendmail -t -i -f noreply@test.com'}
            - {name: log_errors, admin: true, type: flag, value: 'on'}
            - {name: error_log, admin: true, value: /var/log/php/test_error.log}
        - name: test2
          user: nobody
          group: nogroup
          listen: 9000
          max_children: 20
          start_servers: 3
          min_spare_servers: 3
          max_spare_servers: 10

Installation from ppa

    - role: php-fpm
      phpfpm_version: ppa-5.6
      phpfpm_modules: [ ... ]
      phpfpm_php_params: { ... }
      phpfpm_pools: [ ... ]

Configure only

    - role: php-fpm
      phpfpm_version: ppa-5.6
      phpfpm_setup: configure
      phpfpm_php_params: { ... }
      phpfpm_pools: [ ... ]

Available parameters

Main

Param Default Description
php-fpm_setup full Setup mode. See OSSHelp KB article
phpfpm_version default See version list bellow
phpfpm_modules [] List of PHP modules
phpfpm_php_params {} List of global PHP parameters
phpfpm_pools [] List of php-fpm pools
phpfpm_initial_setup false Whether to prepare initial-setup script, ensuring the presence of necessary directories/files before the service start
phpfpm_disable_pools false If set to true, pools will be created in fpm/pool.disabled directory. Make sure to add proper post-deploy tests.

Pool parameters

Param Default Description
name - Pool name
user - Pool user
listen '/run/php/php' ~ phpfpm_version_number ~ '-fpm_' ~ pool.name ~ '.sock' Listen. Unix socket path or tcp addr:port
listen_owner www-data Listen owner. For unix socket only
listen_group www-data Listen group. For unix socket only
pm dynamic Child processes management

All supported options you can see in pool template. More information about parameters in official pool example.

Misc

These parameters shouldn't be changed.

Param Default Description
phpfpm_ppa ppa:ondrej/php PHP-FPM ppa
phpfpm_service php{{ phpfpm_version_number }}-fpm PHP-FPM service name
phpfpm_conf_dir /etc/php/{{ phpfpm_version_number }} PHP-FPM conf directory
phpfpm_pools_dir {{ phpfpm_conf_dir }}/fpm/pool.d PHP-FPM pools directory
phpfpm_php_log_dir /var/log/php PHP logs directory
phpfpm_mail_log_path {{ phpfpm_php_log_dir }}/mail.log PHP mail() function log file

Other parameters here.

Available versions

Versions from ppa only avalaible for bionic and focal!

  • default
  • ppa-5.6
  • ppa-7.0
  • ppa-7.1
  • ppa-7.2
  • ppa-7.3
  • ppa-7.4
  • ppa-8.0

FAQ

...

Useful links

TODO

  • enable/disable modules functional
  • move default pool parameters from pool.j2 to defaults

License

GPL3

Author

OSSHelp Team, see https://oss.help