roots / trellis

WordPress LEMP stack with PHP 8.2, Composer, WP-CLI and more
https://roots.io/trellis/
MIT License
2.51k stars 607 forks source link

extract nginx package as variable? #1345

Closed techieshark closed 2 years ago

techieshark commented 2 years ago

In the interest of avoiding editing the roles/* files (to make upgrades easier), I wonder if it'd make sense to have the nginx_package take a variable instead of hard-coding nginx as the package?

https://github.com/roots/trellis/blob/2f92b67f42b17fecbddcf082b63b5809cdfa42b3/roles/nginx/defaults/main.yml#L5

I'm editing the file like so, currently (the -extras version gives ability to modify the Server: header, which is one reason I use it), but this has the downside of going against some advice on avoiding merge conflicts on upgrades.

nginx_package: nginx-extras

Should I submit a PR for this?

swalkinshaw commented 2 years ago

Any value in a file under defaults is already a variable. You can already easily override nginx_package by just re-defining it in your group_vars somewhere (probably under all/main.yml).

See https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#understanding-variable-precedence