Skip to content
Snippets Groups Projects
README.md 1.29 KiB
Newer Older
Simon Leary's avatar
Simon Leary committed
# unity.bitwarden
Simon Leary's avatar
Simon Leary committed

This collection adds two new lookup plugins: `unity.bitwarden.bitwarden` and `unity.bitwarden.attachment_base64`, as well as a module `unity.bitwarden.write_base64_to_file`. The Bitwarden CLI `bw` is slow and cannot run in parallel. These lookups implement their own cacheing and locking so they can be fast and run in parallel.

`unity.bitwarden.bitwarden.` is a wrapper around `community.general.bitwarden.` with some restrictions to the interface:
Simon Leary's avatar
Simon Leary committed

* must receive exactly one positional argument
* must output exactly one result.

Also, they check for the option `default_bw_collection_id` and use it as an argument to `community.general.bitwarden` if no other collection ID was provided.
Simon Leary's avatar
Simon Leary committed

## example usage:

plaintext:
Simon Leary's avatar
Simon Leary committed
```yml
Simon Leary's avatar
Simon Leary committed
- name: install secret file
  ansible.builtin.copy:
    dest: /path/to/secretfile
    content: "{{ lookup('unity.bitwarden.bitwarden', 'secret', field='notes') }}"
Simon Leary's avatar
Simon Leary committed
    owner: root
    group: root
Simon Leary's avatar
Simon Leary committed
    mode: "0600"
Simon Leary's avatar
Simon Leary committed
```

Simon Leary's avatar
Simon Leary committed
binary:

```yml
- name: install secret file
  unity.bitwarden.write_base64_to_file:
    dest: /path/to/secretfile
    content: "{{ lookup('unity.bitwarden.attachment_base64', item_name='secret', attachment_filename='secret') }}"
Simon Leary's avatar
Simon Leary committed
    owner: root
    group: root
    mode: "0600"
```
Simon Leary's avatar
Simon Leary committed

see the `DOCUMENTATION` strings in the source code for more information.