Mark vars that shouldn't be templated with AnsibleUnsafe instead of {% raw %} #1071
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey! 👋
Been a long time since I contributed here. I maintain https://github.com/louim/bedrock-site-protect and I was investigating louim/bedrock-site-protect#19. The issue is related to string containing jinja delimiters like
{{
or{%
, like salts or passwords. I see that trellis deal with those strings with raw_vars to wrap those string with jinja {% raw %} tags.However, it seems like templating those value in a variable (using the values in a variable that will itself be templated) will break the raw escaping, which is causing the issue in my case. I had a look at an issue where they recommended using
!unsafe
to deal with values that need to be escaped in yaml variables.I had a look at what the
raw_vars
does in trellis, and tweaked it a little to use Ansible UnsafeProxy instead of wrapping the variables with raw tags. UnsafeProxywrap_var
is what adding!unsafe
in a yaml template does under the hood.I redid the test that @fullyint mentioned in #615 (comment) to confirm that the code is still producing the same result.
I also confirmed that it fixes louim/bedrock-site-protect#19.
However, It's been a loooong time since I used Trellis, I may not be aware of all the subtleties of the code and uses-case, so I would really appreciate 👀 to ensure I haven't broken anything by mistake. Also happy to discuss! 🎉