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 }}’ ) }}”
`