Adding a custom PHP extension today requires verbose, version-templated syntax in group_vars/all/main.yml:
php_extensions_custom:
"php{{ php_version }}-soap": "{{ apt_package_state }}"
Proposal
Allow php_extensions_custom to be a plain list of short names:
php_extensions_custom:
- soap
- gd
- imap
Trellis would internally expand each entry to "php{{ php_version }}-{{ item }}": "{{ apt_package_state }}" before merging into php_extensions_default.
Backwards compatibility
Keep accepting the existing dict form so no one's playbook breaks:
# still valid
php_extensions_custom:
"php{{ php_version }}-soap": "{{ apt_package_state }}"
The verify task in roles/common/tasks/main.yml would need to allow either a list of strings or a dict, and the merge in roles/php/defaults/main.yml (php_extensions: "{{ php_extensions_default | combine(php_extensions_custom) }}") would need a normalization step ahead of the combine.
Optional stretch
Same treatment for php_extensions_default overrides in roles/php/vars/<version>.yml, so version-specific files can also use short names.
Ref 5f398b2
Ref https://discourse.roots.io/t/php-extensions-custom-must-be-formatted-as-dicts/11039/
Adding a custom PHP extension today requires verbose, version-templated syntax in
group_vars/all/main.yml:Proposal
Allow
php_extensions_customto be a plain list of short names:Trellis would internally expand each entry to
"php{{ php_version }}-{{ item }}": "{{ apt_package_state }}"before merging intophp_extensions_default.Backwards compatibility
Keep accepting the existing dict form so no one's playbook breaks:
The verify task in
roles/common/tasks/main.ymlwould need to allow either a list of strings or a dict, and the merge inroles/php/defaults/main.yml(php_extensions: "{{ php_extensions_default | combine(php_extensions_custom) }}") would need a normalization step ahead of the combine.Optional stretch
Same treatment for
php_extensions_defaultoverrides inroles/php/vars/<version>.yml, so version-specific files can also use short names.Ref 5f398b2
Ref https://discourse.roots.io/t/php-extensions-custom-must-be-formatted-as-dicts/11039/