home-server/roles/php/tasks/main.yml

125 lines
2.8 KiB
YAML

---
# The home-server project produces a multi-purpose setup using Ansible.
# Copyright © 2018 Y. Gablin, under the GPL-3.0-or-later license.
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
### UPSTREAM BEGIN ⇒ ###
- name: pull prerequisites from upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=upstream.yml
vars:
msg: php
### ⇐ UPSTREAM BEGIN ###
- name: install software
package:
name: "{{item}}"
state: present
with_items:
- php-apcu
- php-gd
- php-imagick
- php-intl
- php-pgsql
- php-pspell
- php-sqlite
- php-xsl
- php-geoip
- geoip-database-extra
### UPSTREAM END ⇒ ###
- name: merge upstream
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=merge.yml
vars:
msg: php
### ⇐ UPSTREAM END ###
- name: enable PHP extensions
lineinfile:
path: /etc/php/conf.d/{{item}}.ini
backrefs: true
regexp: '^;\s*(extension\s*=\s*{{item}}).*$'
line: '\1'
with_items:
- apcu
- geoip
- imagick
- name: alter PHP APCu configuration lines
lineinfile:
path: /etc/php/conf.d/apcu.ini
regexp: '^;*{{item.name}}\s*='
line: '{{item.name}}={{item.value}}'
with_items:
- {name: 'apc.enable_cli', value: 1}
notify:
- restart php-fpm.service (front)
- name: activate PHP extensions
lineinfile:
path: /etc/php/php.ini
backrefs: true
regexp: '^;*((?:zend_)?extension={{item}}(?:\.so)?)\s*$'
line: '\1'
with_items:
- bcmath
- bz2
- calendar
- dba
- exif
- gd
- gettext
- gmp
- iconv
- intl
- ldap
- opcache
- pdo_pgsql
- pdo_sqlite
- pgsql
- pspell
- shmop
- soap
- sockets
- sqlite3
- sysvmsg
- xmlrpc
- xsl
notify:
- restart php-fpm.service (front)
- name: disable PHP configuration lines
lineinfile:
path: /etc/php/php.ini
backrefs: true
regexp: '^({{item}}\s*=.*)$'
line: ';\1'
with_items:
- output_buffering
notify:
- restart php-fpm.service (front)
- name: alter PHP configuration lines
lineinfile:
path: /etc/php/php.ini
regexp: '^;*{{item.name}}\s*='
line: '{{item.name}}={{item.value}}'
with_items:
- {name: max_execution_time, value: 0}
- {name: max_input_time, value: -1}
- {name: memory_limit, value: 512M}
- {name: post_max_size, value: 0}
- {name: 'cgi.fix_pathinfo', value: 0}
- {name: upload_tmp_dir, value: /var/tmp/}
- {name: upload_max_filesize, value: "{{http_max_upload}}"}
- {name: 'date.timezone', value: "{{timezone}}"}
notify:
- restart php-fpm.service (front)
### LOCAL COMMIT ⇒ ###
- name: commit local changes
include_role: name=etckeeper.inc allow_duplicates=true tasks_from=local.yml
vars:
msg: php
### ⇐ LOCAL COMMIT ###
- meta: flush_handlers