Enable configuration via variables
This commit is contained in:
parent
61299bb763
commit
90de9d5861
6 changed files with 39 additions and 71 deletions
|
@ -8,3 +8,17 @@ php_fpm_memory_high: "25%"
|
||||||
php_fpm_memory_max: "35%"
|
php_fpm_memory_max: "35%"
|
||||||
|
|
||||||
apache_php_module_name: "libapache2-mod-php{{ php_version.stdout }}"
|
apache_php_module_name: "libapache2-mod-php{{ php_version.stdout }}"
|
||||||
|
|
||||||
|
php_fpm_config:
|
||||||
|
upload_max_filesize: 15M
|
||||||
|
post_max_size: "{{ upload_max_filesize }}"
|
||||||
|
memory_limit: 256M
|
||||||
|
max_execution_time: 300
|
||||||
|
date.timezone: Europe/Berlin
|
||||||
|
default_charset: UTF-8
|
||||||
|
apc.rfc1867: 1
|
||||||
|
display_errors: "Off"
|
||||||
|
allow_url_fopen: "Off"
|
||||||
|
assert.active: "Off"
|
||||||
|
mail.add_x_header: "Off"
|
||||||
|
session.use_strict_mode: 1
|
||||||
|
|
|
@ -1,29 +1,17 @@
|
||||||
---
|
---
|
||||||
- name: "PHP | Copy custom PHP configuration"
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: php.ini
|
|
||||||
dest: "/etc/php/{{ php_version.stdout }}/mods-available/{{ inventory_hostname }}.ini"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: "PHP | Copy custom PHP-FPM configuration"
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: php-fpm.ini
|
|
||||||
dest: "/etc/php/{{ php_version.stdout }}/mods-available/{{ inventory_hostname }}-fpm.ini"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: "PHP | Enable PHP configuration for mod_php"
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: "/etc/php/{{ php_version.stdout }}/mods-available/{{ inventory_hostname }}.ini"
|
|
||||||
dest: "/etc/php/{{ php_version.stdout }}/apache2/conf.d/30-{{ inventory_hostname }}.ini"
|
|
||||||
state: link
|
|
||||||
when: "'apache_php_module_name' in ansible_facts.packages"
|
|
||||||
notify: reload apache2
|
|
||||||
|
|
||||||
- name: "PHP | Enable PHP cli configuration"
|
- name: "PHP | Enable PHP cli configuration"
|
||||||
ansible.builtin.file:
|
ansible.builtin.template:
|
||||||
src: "/etc/php/{{ php_version.stdout }}/mods-available/{{ inventory_hostname }}.ini"
|
src: php-cli.ini.j2
|
||||||
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-{{ inventory_hostname }}.ini"
|
dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-{{ inventory_hostname }}.ini"
|
||||||
state: link
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: "PHP | Enable PHP FPM configuration"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: php-fpm.ini.j2
|
||||||
|
dest: "/etc/php/{{ php_version.stdout }}/fpm/conf.d/30-{{ inventory_hostname }}.ini"
|
||||||
|
mode: "0644"
|
||||||
|
when: "'php-fpm' in ansible_facts.packages"
|
||||||
|
notify: reload php-fpm
|
||||||
|
|
||||||
- name: "PHP | Create log directory"
|
- name: "PHP | Create log directory"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -31,14 +19,6 @@
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: "PHP | Enable PHP FPM configuration"
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: "/etc/php/{{ php_version.stdout }}/mods-available/{{ inventory_hostname }}-fpm.ini"
|
|
||||||
dest: "/etc/php/{{ php_version.stdout }}/fpm/conf.d/30-{{ inventory_hostname }}-fpm.ini"
|
|
||||||
state: link
|
|
||||||
when: "'php-fpm' in ansible_facts.packages"
|
|
||||||
notify: reload php-fpm
|
|
||||||
|
|
||||||
- name: "PHP | Copy template for PHP-FPM systemd service and socket"
|
- name: "PHP | Copy template for PHP-FPM systemd service and socket"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "systemd/{{ item }}"
|
src: "systemd/{{ item }}"
|
||||||
|
|
7
templates/php-cli.ini.j2
Normal file
7
templates/php-cli.ini.j2
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
; Ansible managed
|
||||||
|
|
||||||
|
{% if php_cli_config is defined %}
|
||||||
|
{% for key, value in php_cli_config.items() %}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
|
@ -1,20 +0,0 @@
|
||||||
; Ansible managed
|
|
||||||
|
|
||||||
upload_max_filesize = {{ php.upload_max_filesize | default ('15M') }}
|
|
||||||
post_max_size = {{ php.post_max_size | default ('15M') }}
|
|
||||||
memory_limit = {{ php.memory_limit | default ('192M') }}
|
|
||||||
max_execution_time = {{ php.max_execution_time | default ('300') }}
|
|
||||||
|
|
||||||
date.timezone = {{ php.date_timezone | default ('Europe/Berlin') }}
|
|
||||||
default_charset = "{{ php.default_charset | default ('UTF-8') }}"
|
|
||||||
|
|
||||||
;Upload-Fortschritt
|
|
||||||
apc.rfc1867 = 1
|
|
||||||
|
|
||||||
display_errors = Off
|
|
||||||
|
|
||||||
;Empfohlene Einstellungen (pcc)
|
|
||||||
allow_url_fopen = Off
|
|
||||||
assert.active = Off
|
|
||||||
mail.add_x_header = Off
|
|
||||||
session.use_strict_mode = 1
|
|
7
templates/php-fpm.ini.j2
Normal file
7
templates/php-fpm.ini.j2
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
; Ansible managed
|
||||||
|
|
||||||
|
{% if php_fpm_config is defined %}
|
||||||
|
{% for key, value in php_fpm_config.items() %}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
|
@ -1,20 +0,0 @@
|
||||||
; Ansible managed
|
|
||||||
|
|
||||||
upload_max_filesize = {{ php.upload_max_filesize | default ('15M') }}
|
|
||||||
post_max_size = {{ php.post_max_size | default ('15M') }}
|
|
||||||
memory_limit = {{ php.memory_limit | default ('192M') }}
|
|
||||||
max_execution_time = {{ php.max_execution_time | default ('300') }}
|
|
||||||
|
|
||||||
date.timezone = {{ php.date_timezone | default ('Europe/Berlin') }}
|
|
||||||
default_charset = "{{ php.default_charset | default ('UTF-8') }}"
|
|
||||||
|
|
||||||
;Upload-Fortschritt
|
|
||||||
apc.rfc1867 = 1
|
|
||||||
|
|
||||||
display_errors = Off
|
|
||||||
|
|
||||||
;Empfohlene Einstellungen (pcc)
|
|
||||||
allow_url_fopen = Off
|
|
||||||
assert.active = Off
|
|
||||||
mail.add_x_header = Off
|
|
||||||
session.use_strict_mode = 1
|
|
Loading…
Reference in a new issue