From a56f185ec2226e0f78a86708d189c3ca3de76413 Mon Sep 17 00:00:00 2001 From: Colan Schwartz <13228-colan@users.noreply.gitlab.com> Date: Fri, 8 Oct 2021 17:51:04 -0400 Subject: [PATCH 1/3] Issue #140: Enable setting for CLI memory limit. --- defaults/main.yml | 4 ++++ tasks/configure-cli.yml | 15 +++++++++++++++ tasks/main.yml | 2 ++ templates/memory_limit.ini.j2 | 5 +++++ 4 files changed, 26 insertions(+) create mode 100644 tasks/configure-cli.yml create mode 100644 templates/memory_limit.ini.j2 diff --git a/defaults/main.yml b/defaults/main.yml index a19fa254..c6cbbc0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -67,6 +67,10 @@ php_enable_apc: true php_apc_shm_size: "96M" php_apc_enable_cli: "0" +# Manage PHP CLI memory limit. +php_set_cli_memory_limit: False +php_cli_memory_limit: "512M" + # If this is set to false, none of the following options will have any effect. # Any and all changes to /etc/php.ini will be your responsibility. php_use_managed_ini: true diff --git a/tasks/configure-cli.yml b/tasks/configure-cli.yml new file mode 100644 index 00000000..ec6ff06e --- /dev/null +++ b/tasks/configure-cli.yml @@ -0,0 +1,15 @@ +--- + +- name: Set PHP CLI memory limit. + block: + - name: Ensure PHP CLI config directory exists. + file: + dest: "/etc/php/{{ php_default_version_debian }}/cli/conf.d/" + state: directory + - name: Set PHP CLI memory limit. + template: + src: memory_limit.ini.j2 + dest: "/etc/php/{{ php_default_version_debian }}/cli/conf.d/20-memory_limit.ini" + become: yes + when: php_set_cli_memory_limit | bool + diff --git a/tasks/main.yml b/tasks/main.yml index dbad7659..46789a13 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -75,3 +75,5 @@ - include_tasks: configure-apcu.yml - include_tasks: configure-opcache.yml - include_tasks: configure-fpm.yml +- include_tasks: configure-cli.yml + diff --git a/templates/memory_limit.ini.j2 b/templates/memory_limit.ini.j2 new file mode 100644 index 00000000..645fce79 --- /dev/null +++ b/templates/memory_limit.ini.j2 @@ -0,0 +1,5 @@ +; {{ ansible_managed }} + +; configuration for increasing PHP CLI memory limit +; priority=20 +memory_limit = {{ php_cli_memory_limit }} From f72f19f90706970a6fff0ed4bd25255bf4436d71 Mon Sep 17 00:00:00 2001 From: Colan Schwartz <13228-colan@users.noreply.gitlab.com> Date: Fri, 8 Oct 2021 17:52:06 -0400 Subject: [PATCH 2/3] Issue #140: Removed extra blank line. --- tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 46789a13..0ecf0087 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -76,4 +76,3 @@ - include_tasks: configure-opcache.yml - include_tasks: configure-fpm.yml - include_tasks: configure-cli.yml - From 03e012eeec43899c72719c235125ed82fb678f4d Mon Sep 17 00:00:00 2001 From: Colan Schwartz <13228-colan@users.noreply.gitlab.com> Date: Tue, 19 Oct 2021 16:16:14 -0400 Subject: [PATCH 3/3] Issue #140: Fixed Lint warnings and errors. --- defaults/main.yml | 2 +- tasks/configure-cli.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c6cbbc0f..6a981278 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -68,7 +68,7 @@ php_apc_shm_size: "96M" php_apc_enable_cli: "0" # Manage PHP CLI memory limit. -php_set_cli_memory_limit: False +php_set_cli_memory_limit: false php_cli_memory_limit: "512M" # If this is set to false, none of the following options will have any effect. diff --git a/tasks/configure-cli.yml b/tasks/configure-cli.yml index ec6ff06e..408e6e48 100644 --- a/tasks/configure-cli.yml +++ b/tasks/configure-cli.yml @@ -10,6 +10,5 @@ template: src: memory_limit.ini.j2 dest: "/etc/php/{{ php_default_version_debian }}/cli/conf.d/20-memory_limit.ini" - become: yes + become: true when: php_set_cli_memory_limit | bool -