Hello Team,
Hope you all are doing well.
Here is a case:
Templates/php_app.conf.j2
;# MANAGED BLOCK ###
php_admin_flag[display_errors] = {{server_config.display_errors}}
php_admin_value[error_log] = {{ server_config.error_log | default({“error_log”:“{{base_directory_path }}/{{app_name}}/logs/php-fpm_error.log”}) }}
php_admin_flag[log_errors] = {{server_config.log_errors}}
php_admin_flag[short_open_tag] = {{server_config.short_open_tag}}
php_admin_value[memory_limit] = {{server_config.memory_limit}}
php_admin_value[post_max_size] = {{server_config.post_max_size}}
php_admin_value[upload_max_filesize] = {{server_config.upload_max_filesize}}
php_admin_value[max_input_time] = {{server_config.max_input_time}}
php_admin_value[max_execution_time] = {{server_config.max_execution_time}}
php_admin_value[max_file_uploads] = {{server_config.max_file_uploads}}
php_admin_value[max_input_vars] = {{server_config.max_input_vars}}
php_admin_value[date.timezone] = {{server_config.time_zone}}
;# MANAGED BLOCK ###
You need one more “}” on your -e string to close out the server_config.
ansible-playbook php_config.yml -i hosts -e ‘{“app_name”:“test-80php”,“base_directory_path”:“/var/www/html/applications/test-80php”,“server_config”:{ “display_errors”:“Off”, “log_errors”:“On”, “memory_limit”:“200M”, “post_max_size”:“8M”, “upload_max_filesize”:“8M”, “max_input_time”:“60”, “max_execution_time”:“30”, “max_file_uploads”:“20”, “max_input_vars”:“2000”, “short_open_tag”:“On”, “time_zone”:“Asia/Karachi”} }}’ -vvv
------------------------------^
Walter
That clearly didn’t display correctly …
You need three close braces at the end of your “-e” extra vars param.
} }}’ -vvv
Hope that helps.
Here is the command previously used, I hope it is clearly visible.
ansible-playbook php_config.yml -i hosts -e ‘{“app_name”:“test-80php”,
“base_directory_path”:“/var/www/html/applications/test-80php”,
“server_config”:{“display_errors”:“Off”,
“log_errors”:“On”,
“memory_limit”:“200M”,
“post_max_size”:“8M”,
“upload_max_filesize”:“8M”,
“max_input_time”:“60”,
“max_execution_time”:“30”,
“max_file_uploads”:“20”,
“max_input_vars”:“2000”,
“short_open_tag”:“On”,
“time_zone”:“Asia/Karachi”}}’ -vvv
Walter, I have tried adding more braces, but unfortunately, it didn’t work for me.
The number of openings and closings braces is the same.
Regards,
Farrukh Ahmed
utoddl
(Todd Lewis)
August 20, 2022, 4:29pm
5
Mustaches do not nest. The “error_log” line in templates/php_app.conf.j2 should be
php_admin_value[error_log] = {{ server_config.error_log | default(base_directory_path ~ "/" ~ "app_name/logs/php-fpm_error.log") }}
Thanks, Lewis for the solution. It actually worked. But would you mind explaining or sharing the documentation of what you have done above inside the “default()”?
I actually want to learn and understand this.
Thanks & regards,
Farrukh Ahmed