diff --git a/files/php-fpm/conf-php b/files/php-fpm/conf-php deleted file mode 100644 index bc3a47f..0000000 --- a/files/php-fpm/conf-php +++ /dev/null @@ -1,3 +0,0 @@ -upstream php-handler { - server unix:/var/run/php/php7.0-fpm.sock; -} diff --git a/handlers/main.yml b/handlers/main.yml index 588e1ec..aeeb6b3 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -6,7 +6,9 @@ service: name=nginx state=reloaded - name: restart php-fpm - service: name=php7.0-fpm state=restarted + service: + name: "php{{ php_version }}-fpm" + state: restarted - name: delete nginx index.nginx-debian.html file: path=/var/www/html/index.nginx-debian.html state=absent diff --git a/tasks/php-fpm.yml b/tasks/php-fpm.yml index 4d9b645..8e4e6bd 100644 --- a/tasks/php-fpm.yml +++ b/tasks/php-fpm.yml @@ -13,7 +13,7 @@ - php-opcache - php-imap - php-intl # intl - - php-mcrypt + #- php-mcrypt - php-smbclient - php-net-ftp - php-exif @@ -37,16 +37,16 @@ - reload nginx - name: copy nginx php upstream - copy: - src: php-fpm/conf-php + template: + src: php-fpm/upstream-php.conf.j2 dest: /etc/nginx/conf.d/php.conf notify: - reload nginx - name: copy php-fpm config - copy: - dest: /etc/php/7.0/fpm/pool.d/www.conf - src: php-fpm/www.conf + template: + dest: "/etc/php/{{ php_version }}/fpm/pool.d/www.conf" + src: php-fpm/www.conf.j2 mode: 0644 notify: - restart php-fpm @@ -60,7 +60,7 @@ - name: copy php-fpm php.ini template: - dest: /etc/php/7.0/fpm/php.ini + dest: "/etc/php/{{ php_version }}/fpm/php.ini" src: php-fpm/php.ini.j2 mode: 0644 notify: diff --git a/templates/php-fpm/upstream-php.conf.j2 b/templates/php-fpm/upstream-php.conf.j2 new file mode 100644 index 0000000..abd303d --- /dev/null +++ b/templates/php-fpm/upstream-php.conf.j2 @@ -0,0 +1,3 @@ +upstream php-handler { + server unix:/var/run/php/php{{ php_version }}-fpm.sock; +} diff --git a/files/php-fpm/www.conf b/templates/php-fpm/www.conf.j2 similarity index 98% rename from files/php-fpm/www.conf rename to templates/php-fpm/www.conf.j2 index 5422e95..b9b3411 100644 --- a/files/php-fpm/www.conf +++ b/templates/php-fpm/www.conf.j2 @@ -33,7 +33,7 @@ group = www-data ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /run/php/php7.0-fpm.sock +listen = /run/php/php{{ php_version }}-fpm.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) @@ -306,12 +306,12 @@ pm.max_spare_servers = 3 ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) ; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; e.g. for a ISO8601 formatted timestring, use: %{ %Y-%m-%dT%H:%M:%S%z }t ; %T: time the log has been written (the request has finished) ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) ; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; e.g. for a ISO8601 formatted timestring, use: %{ %Y-%m-%dT%H:%M:%S%z }t ; %u: remote user ; ; Default: "%R - %u %t \"%m %r\" %s" diff --git a/vars/main.yml b/vars/main.yml index 76aefda..8c06b43 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,4 @@ +php_version: "{% if ansible_distribution_release == 'stretch' %}7.0{% endif %}{% if ansible_distribution_release == 'buster' %}7.3{% endif %}" monitoring: checks: local: