From a19adf515006ddb2fbec561d10b50348b0f1b94f Mon Sep 17 00:00:00 2001 From: Emilien M Date: Thu, 26 Dec 2019 14:13:00 +0100 Subject: [PATCH] Improvements (#13) - Store configuration in local facts - Better socket generator - php_admin_value/php_value - Manages PHP 7.4 on Debian --- .gitignore | 1 + .travis.yml | 8 +-- README.md | 16 ++--- Vagrantfile | 4 ++ defaults/main.yml | 4 +- filter_plugins/__pycache__/php.cpython-37.pyc | Bin 0 -> 615 bytes filter_plugins/php.py | 10 ++++ tasks/fpm.yml | 6 +- tasks/main.yml | 56 +++++++++++++++--- templates/etc/__php__/fpm/pool.d/pool.conf.j2 | 34 +++++------ tests/includes/pre_Debian.yml | 5 +- tests/templates/nginx.conf.j2 | 19 +++--- tests/test.yml | 32 ++++++++-- 13 files changed, 135 insertions(+), 60 deletions(-) create mode 100644 filter_plugins/__pycache__/php.cpython-37.pyc create mode 100644 filter_plugins/php.py diff --git a/.gitignore b/.gitignore index 62ff262..26e7b43 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.swp *.retry *.log +/filter_plugins/*.pyc diff --git a/.travis.yml b/.travis.yml index abd8b34..2f1809c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,13 @@ env: - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-debian-stretch-php72' ANSIBLE_VERSION='ansible>=2.6,<2.7' - - PLATFORM='docker-debian-stretch-php73' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-debian-stretch-php70' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-stretch-php71' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-stretch-php72' ANSIBLE_VERSION='ansible>=2.7,<2.8' - - PLATFORM='docker-debian-stretch-php73' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-debian-stretch-php74' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-debian-buster-php73' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-debian-buster-php74' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-ubuntu-xenial-php70' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-ubuntu-bionic-php72' ANSIBLE_VERSION='ansible>=2.7,<2.8' diff --git a/README.md b/README.md index 07212cf..50479f1 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ Install PHP on Debian / Ubuntu / FreeBSD. Manage PHP-FPM, APCu, Opcache and Xdeb Managed OS / Versions --------------------- -| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | -|:---------------------:|:-------------------:|:--------------------------:|:--------------------------:|:-------------------------:| -| Debian Stretch (9) | :heavy_check_mark: | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | -| Debian Buster (10) | :x: | :x: | :x: | :heavy_check_mark: | -| Ubuntu Xenial (16.04) | :heavy_check_mark: | :x: | :x: | :x: | -| Ubuntu Bionic (18.04) | :x: | :x: | :heavy_check_mark: | :x: | -| FreeBSD 11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | -| FreeBSD 12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | +| OS | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | +|:---------------------:|:-------------------:|:--------------------------:|:--------------------------:|:-------------------------:|:--------------------------: +| Debian Stretch (9) | :heavy_check_mark: | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | :heavy_check_mark: (Sury) | +| Debian Buster (10) | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: (Sury) | +| Ubuntu Xenial (16.04) | :heavy_check_mark: | :x: | :x: | :x: | :x: | +| Ubuntu Bionic (18.04) | :x: | :x: | :heavy_check_mark: | :x: | :x: | +| FreeBSD 11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | +| FreeBSD 12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | Need tests... | Links: - [Sury](https://deb.sury.org/) diff --git a/Vagrantfile b/Vagrantfile index 2ceb8d1..d0b5a26 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,7 +10,9 @@ Vagrant.configure("2") do |config| { :name => "debian-stretch-php71", :box => "debian/stretch64", :vars => { "php_version": '7.1' }}, { :name => "debian-stretch-php72", :box => "debian/stretch64", :vars => { "php_version": '7.2' }}, { :name => "debian-stretch-php73", :box => "debian/stretch64", :vars => { "php_version": '7.3' }}, + { :name => "debian-stretch-php74", :box => "debian/stretch64", :vars => { "php_version": '7.4' }}, { :name => "debian-buster-php73", :box => "debian/buster64", :vars => { }}, + { :name => "debian-buster-php74", :box => "debian/buster64", :vars => { "php_version": '7.4' }}, { :name => "ubuntu-xenial-php70", :box => "ubuntu/xenial64", :vars => { }}, { :name => "ubuntu-bionic-php72", :box => "ubuntu/bionic64", :vars => { }}, ] @@ -25,7 +27,9 @@ Vagrant.configure("2") do |config| { :name => "docker-debian-stretch-php71", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.1' }}, { :name => "docker-debian-stretch-php72", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.2' }}, { :name => "docker-debian-stretch-php73", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.3' }}, + { :name => "docker-debian-stretch-php74", :docker => "hanxhx/vagrant-ansible:debian9", :vars => { "php_version": '7.4' }}, { :name => "docker-debian-buster-php73", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { }}, + { :name => "docker-debian-buster-php74", :docker => "hanxhx/vagrant-ansible:debian10", :vars => { "php_version": '7.4' }}, { :name => "docker-ubuntu-xenial-php70", :docker => "hanxhx/vagrant-ansible:ubuntu16.04", :vars => { }}, { :name => "docker-ubuntu-bionic-php72", :docker => "hanxhx/vagrant-ansible:ubuntu18.04", :vars => { }}, ] diff --git a/defaults/main.yml b/defaults/main.yml index 6cd4fb2..a0c4707 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -90,10 +90,10 @@ php_xdebug_var_display_max_depth: '3' # PHP-FPM php_fpm_poold: - - pool_name: 'www' + - name: 'www' listen: '{{ php_default_fpm_sock }}' pm: 'dynamic' - pm_max_children: 250 + pm_max_children: 100 pm_start_servers: 10 pm_min_spare_servers: 10 pm_max_spare_servers: 20 diff --git a/filter_plugins/__pycache__/php.cpython-37.pyc b/filter_plugins/__pycache__/php.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a4d8ec2b84b92e02cf7c1f8bb4099cf22c64c8e GIT binary patch literal 615 zcmZuuy-ve05Vn()hLUawA;i#yAw!!1i3y3rYa<+R;y5s3Q)&!gZlmm*>1zFI@*db774CZ@YUZ!3)$q)ys3tyB?drF3n?@-`x zL7L4(u40+`o0*geOM|J%DfH6n>&TnPsqiL2`s{Hr^M>cQqZ=>b^llo@8xNp@fSI&i|xt6?4 z#N6o&uZEqe4mu$cprFNm`W!YmoE9Xe`V^Yktp{*vWhs$Fe{1IWtZLS)s3rvUz{Y%g zowxT>FmM}{&Ge}lt6GfJlYs9q_EZK59ucA@V_b%e /dev/null | grep h1 | grep -o 'PHP Version {{ php_version }}' | sed -r 's/ /dev/null" + args: + warn: false + changed_when: false + register: c + failed_when: 'php_fpm_poold.1.php_admin_value.memory_limit not in c.stdout' + - name: URI | Check ping uri: url: "http://localhost{{ php_fpm_poold.0.ping_path }}"