Bug: bitwarden.secrets.lookup errors when no secrets are available

I would usually report this as a bug, but GitHub - bitwarden/sm-ansible: Ansible integration for Secrets Manager strongly resisted my attempt, and this forum things everything is a feature request which makes me suspect it is also the wrong place.

Should this be reported to Issues · bitwarden/clients · GitHub ?

Running Ansible with ‘bitwarden.secrets.lookup’ I have the following error:

Error was a <class ‘ansible.errors.AnsibleError’>, original message: An unhandled exception occurred while templating ‘{{ lookup(‘bitwarden.secrets.lookup’, ‘[secret uuid]’, access_token=bitwarden_secrets_token) }}’.

… more output form template …

Error was a <class ‘ansible.errors.AnsibleError’>, original message: An unhandled exception occurred while running the lookup plugin ‘bitwarden.secrets.lookup’. Error was a <class ‘IndexError’>, original message: Replacement index 1 out of range for positional args tuple. Replacement index 1 out of range for positional args tuple"}

It turns out that error is because the machine account stored in bitwarden_secrets_token has access to zero secrets. Once I gave it access to secrets the error resolved and my files templated correctly.

Hopefully this information helps someone else.

3 Likes

i can confirm that. i forgot to add my machine account to the project, which caused the issue. after adding machine account to project everything worked fine.

thx

1 Like