community.general.bitwarden lookup – Retrieve secrets from Bitwarden

Note

This lookup plugin is part of the community.general collection (version 5.8.3).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this lookup plugin, see Requirements for details.

To use it in a playbook, specify: community.general.bitwarden.

New in community.general 5.4.0

Synopsis

  • Retrieve secrets from Bitwarden.

Requirements

The below requirements are needed on the local controller node that executes this lookup.

  • bw (command line utility)

  • be logged into bitwarden

Terms

Parameter

Comments

Terms

list / elements=string / required

Key(s) to fetch values for from login info.

Keyword parameters

This describes keyword parameters of the lookup. These are the values key1=value1, key2=value2 and so on in the following examples: lookup('community.general.bitwarden', key1=value1, key2=value2, ...) and query('community.general.bitwarden', key1=value1, key2=value2, ...)

Parameter

Comments

field

string

Field to fetch; leave unset to fetch whole response.

string

added in community.general 5.7.0

Field to retrieve, for example name or id.

Default: "name"

Notes

Note

  • When keyword and positional parameters are used together, positional parameters must be listed before keyword parameters: lookup('community.general.bitwarden', term1, term2, key1=value1, key2=value2) and query('community.general.bitwarden', term1, term2, key1=value1, key2=value2)

Examples

- name: "Get 'password' from Bitwarden record named 'a_test'"
  ansible.builtin.debug:
    msg: >-
      {{ lookup('community.general.bitwarden', 'a_test', field='password') }}

- name: "Get 'password' from Bitwarden record with id 'bafba515-af11-47e6-abe3-af1200cd18b2'"
  ansible.builtin.debug:
    msg: >-
      {{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') }}

- name: "Get full Bitwarden record named 'a_test'"
  ansible.builtin.debug:
    msg: >-
      {{ lookup('community.general.bitwarden', 'a_test') }}

Return Value

Key

Description

Return value

list / elements=any

List of requested field or JSON object of list of matches.

Returned: success

Authors

  • Jonathan Lung (@lungj)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.