-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Cache #11
Comments
The `LookupModule` is initialised during every lookup. This results in a new Bitwarden object for every lookup removing the benefit of the cache. However, importing the bitwarden Lookup module is only done at specific stages during a playbook and not run for every lookup itself. So changing the cache to a global variable makes it persistent for as long as possible and thus making the cache actually benefical for improving the executing time. Fixes c0sco#11
@markusressel I've created a PR to resolve this issue as much as possible. However, due to the way Ansible is implemented it is not possible to implement a cache which exists for the entire Playbook. Ansible simply does not implement that type of control within a single lookup plugin. The existence of a lookup plugin code is never the entirety of the Ansible playbook. However this PR ensures that a cache exists for as long as possible within Ansible, thus greatly improving lookup times within similar tasks and lookups. Especially when using this lookup plugin for become passwords this greatly increases execution times. |
Thx for the effort, I also did some testing (months ago) and had the same conclusion 😢 I thought about writing and reading decrypted passwords to a file (in some form of tmpfs that sits in memory), but that could cause some major security concerns in itself and we are probably not be able to cleanup this file afterwards. Reading this file would probably still be faster than querying bitwarden though 😄 |
When running an ansible project on a comparably slow netbook I noticed that ansible takes a really long time for each step. When evaluating the
htop
output I noticed that bitwarden is called each and every time a task uses thebecome: true
option, since I have configured the project to fetch the sudo password from bitwarden.It would be nice if this module would cache the values of password lookups, to speed up querying of the same item when it is accessed more than once.
The text was updated successfully, but these errors were encountered: