From c4197a51114aafe6698bf9c84f81af774a22535d Mon Sep 17 00:00:00 2001 From: Rottler Tamas Date: Sat, 24 Jun 2023 01:30:17 +0200 Subject: [PATCH] debian 12 --- tasks/main.yml | 97 +++++++++++++------ .../000-default_fpm.conf | 2 +- templates/pool_www.conf | 15 +++ 3 files changed, 84 insertions(+), 30 deletions(-) rename files/000-default_fpm7.4.conf => templates/000-default_fpm.conf (83%) create mode 100644 templates/pool_www.conf diff --git a/tasks/main.yml b/tasks/main.yml index 0dcc905..dc13c5e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -87,9 +87,19 @@ create: yes when: - ansible_distribution == "Debian" - - ansible_distribution_major_version|int() >= 11 + - ansible_distribution_major_version|int() == 11 -- name: apt update, bullseye +- name: sury repo in sources list, bookworm + tags: apt + lineinfile: + dest: /etc/apt/sources.list.d/php-sury.list + line: 'deb https://packages.sury.org/php/ bookworm main' + create: yes + when: + - ansible_distribution == "Debian" + - ansible_distribution_major_version|int() >= 12 + +- name: apt update, bullseye+ tags: apt apt: update_cache: yes @@ -97,30 +107,59 @@ - ansible_distribution == "Debian" - ansible_distribution_major_version|int() >= 11 -- name: install packages, bullseye +- name: set phpver for debian bullseye + set_fact: + phpver: "7.4" + when: + - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() == 11) or + (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) + +- name: set phpver for debian bookworm+ + set_fact: + phpver: "8.2" + when: + - ansible_distribution == "Debian" + - ansible_distribution_major_version|int() >= 12 + +- name: install packages, bullseye+ tags: apt apt: name: - apache2 - mariadb-client - - php7.4-cli - - php7.4-fpm - - php7.4-bcmath - - php7.4-curl - - php7.4-gd - - php7.4-json - - php7.4-ldap - - php7.4-mbstring - - php7.4-mysql - - php7.4-opcache - - php7.4-readline - - php7.4-soap - - php7.4-xml - - php7.4-zip + - "php{{ phpver }}-cli" + - "php{{ phpver }}-fpm" + - "php{{ phpver }}-bcmath" + - "php{{ phpver }}-curl" + - "php{{ phpver }}-gd" + - "php{{ phpver }}-ldap" + - "php{{ phpver }}-mbstring" + - "php{{ phpver }}-mysql" + - "php{{ phpver }}-opcache" + - "php{{ phpver }}-readline" + - "php{{ phpver }}-soap" + - "php{{ phpver }}-xml" + - "php{{ phpver }}-zip" state: present when: - - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 11) or - (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) + - phpver is defined + +- name: install packages, bullseye+ + tags: apt + apt: + name: + - "php{{ phpver }}-json" + state: present + when: + - phpver is defined + - phpver == "7.4" + +- name: php fpm/pool.d/www.conf, bullseye+ + template: + src: pool_www.conf + dest: "/etc/php/{{ phpver }}/fpm/pool.d/www.conf" + when: + - phpver is defined - name: conf-available copy: @@ -151,9 +190,9 @@ - ansible_distribution == "Debian" - ansible_distribution_major_version|int() < 11 -- name: virtualhost config, bullseye - copy: - src: 000-default_fpm7.4.conf +- name: virtualhost config, bullseye+ + template: + src: 000-default_fpm.conf dest: /etc/apache2/sites-available/000-default.conf when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 11) or @@ -195,13 +234,13 @@ - ansible_distribution == "Debian" - ansible_distribution_major_version == "10" -- name: php config, bullseye - copy: - src: hws.php.ini.fpm - dest: /etc/php/7.4/hws.php.ini - when: - - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 11) or - (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) +#- name: php config, bullseye +# copy: +# src: hws.php.ini.fpm +# dest: /etc/php/7.4/hws.php.ini +# when: +# - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() == 11) or +# (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) - name: php config symlinks, stretch file: diff --git a/files/000-default_fpm7.4.conf b/templates/000-default_fpm.conf similarity index 83% rename from files/000-default_fpm7.4.conf rename to templates/000-default_fpm.conf index 2389ace..ea48c62 100644 --- a/files/000-default_fpm7.4.conf +++ b/templates/000-default_fpm.conf @@ -9,7 +9,7 @@ Require all granted - SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost" + SetHandler "proxy:unix:/run/php/php{{ phpver }}-fpm.sock|fcgi://localhost" diff --git a/templates/pool_www.conf b/templates/pool_www.conf new file mode 100644 index 0000000..d633078 --- /dev/null +++ b/templates/pool_www.conf @@ -0,0 +1,15 @@ +[www] +user = www-data +group = www-data +listen = /run/php/php{{ phpver }}-fpm.sock +listen.owner = www-data +listen.group = www-data +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 + +php_admin_value[user_ini.filename] = .php.ini +php_admin_value[user_ini.cache_ttl] = 60 +