Closed moorglade closed 7 years ago
I don't have a good reason for you off the top of my head.
In that case, would it be OK if I submitted a PR with an optional parameter stringify_data=True
added to the lookup plugin?
I did some testing and this seems be easy to implement, and would simplify my use case.
I was thinking just release it on a new major release.
You mean without the str()
call on the lookup result? If that doesn't break anything for you, that'd be fine for me.
Hopefully this will cover your use case https://github.com/TerryHowe/ansible-modules-hashivault/commit/170b41f6bb0389474abc57330a629cca8d7c8ab0
A quick question about the behavior of the lookup module:
I've observed that the data received from Vault is always converted to a string, regardless of its real type.
For example, if I have a list stored in Vault:
then the value returned by the lookup plugin is a string instead of a proper list, i.e.:
If I assign this result directly to an Ansible variable, it gets automatically converted to a list by the Ansible's templating engine. It is not possible, however, to use the result directly in a more complex Jinja2 expression, such as:
The above expression does not return the first element from the list (as I would expect), but the first character of the string (
[
).Is there any reason why the lookup plugin cannot return a proper list in such a case?