make it work on debian - version issue

This commit is contained in:
2024-03-06 17:19:24 +01:00
parent d2bdd28804
commit 57a2eb71da
5 changed files with 29 additions and 8 deletions

View File

@@ -13,7 +13,7 @@ None
Role Variables
--------------
php_poolname: default www_{{ php_version_nodot }}
php_pool_name: default www_{{ php_version_nodot }}
php_version: STRING default "8.2"
php_fpm_pool_user: default apache
php_fpm_pool_group: default apache
@@ -44,7 +44,7 @@ Including an example of how to use your role (for instance, with variables passe
roles:
- role: tconstans.php-fpm
vars:
php_poolname: pool1
php_pool_name: pool1
php_fpm_listen_url: "/srv/pool1/php-fpm.sock"
php_version_nodot: 74
php_packages:
@@ -63,7 +63,7 @@ Including an example of how to use your role (for instance, with variables passe
- php{{ php_version_nodot }}-php-ctype
- role: tconstans.php-fpm
vars:
php_poolname: pool2
php_pool_name: pool2
php_fpm_listen_url: "/srv/pool2/php-fpm.sock"
php_version_nodot: 80
php_packages:

View File

@@ -1,8 +1,9 @@
---
# defaults file for php-fpm
php_version: "8.2"
php_version_nodot: "{{php_version[0]}}{{php_version[2]}}"
php_poolname: "www_{{ php_version_nodot }}"
php_version_string: "{{ php_version | string }}"
php_version_nodot: "{{php_version_string[0]}}{{php_version_string[2]}}"
php_pool_name: "www_{{ php_version_nodot }}"
php_fpm_pool_user: "{{ apache_user }}"
php_fpm_pool_group: "{{ apache_group }}"
php_fpm_listen_url: 127.0.0.1:90{{ php_version_nodot }}

View File

@@ -16,6 +16,25 @@
state: present
when: ansible_os_family=='RedHat'
- name: "setup repository - debian"
block:
- name: setup repo key
ansible.builtin.get_url:
url: https://packages.sury.org/php/apt.gpg
dest: /etc/apt/keyrings/sury_php.gpg
- name: setup source list
ansible.builtin.template:
src: php_sury_sources.list
dest: /etc/apt/sources.list.d/php_sury.sources.list
register: repo_setup
- name: update cache
ansible.builtin.apt:
update_cache: true
when: repo_setup.changed
when: ansible_os_family | lower == 'debian'
- name: create socket directory if needed
file:
path: "{{ php_fpm_listen_url|dirname }}"
@@ -37,7 +56,7 @@
- name: configure php-fpm pool 2
template:
src: www.conf
dest: "{{ php_fpm_pool_dir }}/{{ php_poolname }}.conf"
dest: "{{ php_fpm_pool_dir }}/{{ php_pool_name }}.conf"
notify: restart php-fpm
- name: start and enable service
@@ -49,4 +68,4 @@
- name: configure logrotate
template:
src: logrotate.conf.jj
dest: /etc/logrotate.d/php-fpm.conf
dest: "/etc/logrotate.d/php-fpm_{{ php_pool_name }}_{{ php_fpm_pool_user }}.conf"

View File

@@ -0,0 +1 @@
deb [signed-by=/etc/apt/keyrings/sury_php.gpg] https://packages.sury.org/php/ {{ ansible_distribution_release }} main

View File

@@ -1,4 +1,4 @@
[{{ php_poolname }}]
[{{ php_pool_name }}]
user = {{ php_fpm_pool_user }}
group = {{ php_fpm_pool_group }}
listen = {{ php_fpm_listen_url }}