I am trying to lookup a secret through Ansible's credstash plugin by first
setting the variable of the table (since I have multiple credstash tables)
and then looking it up - , something like this:
credstash_table: "foo_credstash_{{ bar }}""
password: "{{ lookup('credstash', 'password', table={{ credstash_table
}} ) }}"
Somehow, it doesn't seem to like this:
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"AnsibleError:
{{ lookup('credstash', 'password', table={{ credstashtable }} ) }}:
template error while templating string: expected token ':', got '}'.
String: {{ lookup('credstash', 'password', table={{ credstashtable }} ) }}"}
I tried this approach:
credstash_table: "foo_credstash_{{ bar }}""
password: "{{ lookup('credstash', 'password', table='{{ credstash_table
}}' ) }}"
Only to get this:
amazon-ebs: fatal: [localhost]: FAILED! => {"changed": false, "failed": true,
"msg": "AnsibleError: {{ lookup('credstash', 'password', table='{{
credstashtable }}' ) }}: An unhandled exception occurred while running the
lookup plugin 'credstash'. Error was a <class 'ansible.errors.AnsibleError'>,
original message: Encountered exception while fetching password: An error
occurred (ValidationException) when calling the Query operation: 1 validation
error detected: Value '{{ credstashtable }}' at 'tableName' failed to satisfy
constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.-]+"}
At the moment, I am using a combination of a bash wrappr script and pipes
to pull that info. It works, but I am not liking that approach.
What would be the right way to look up the table set as a variable in the
plugin? Or am I doing it wrong?
- Rilindo
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/58b6a2cb-a10b-4cfc-979d-f22f00b638d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.