Escape salts and keys to avoid templating errors #548
Merged
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.
This PR adds a new vars plugin built from Ansible's noop.py example. The new plugin escapes WP env salts and keys (
group_vars/<environment>/vault.yml) by wrapping them in{% raw %}to prevent the problem that arises when the strings include{{or{%(e.g., #484).Here is an excerpt of the remote's
.envproduced by a deploy. No longer causes errors on deploy.This PR adds one vars plugin file, still mirroring Ansible project's structure.
Note. The
lib/ansible/plugins/varsdir is there in Ansible, but the example vars plugin they offer is inlib/ansible/inventory/vars_plugins.The new plugin uses
host.vars[key] = valueto override var, because vars returned byhost.get_group_varsare only a copy. Changing the latter (the copy) would have no effect.Note. Don't be alarmed if you test this in a
debugtask and it doesn't work. This works for Trellis usage ofwordpress_sites[site].envin template module. The{% raw %}tags are indeed being added. The debug module can printvault_wordpress_sites['example.com'].env.nonce_keybut notitem.value.env.nonce_keyusingwith_dict. It seems the debug module sometimes doesn't honor the{% raw %}tags (?).