|
5 | 5 | from __future__ import (absolute_import, division, print_function)
|
6 | 6 | __metaclass__ = type
|
7 | 7 |
|
8 |
| -DOCUMENTATION = """ |
9 |
| - name: bitwarden |
10 |
| - author: |
11 |
| - - Jonathan Lung (@lungj) <[email protected]> |
12 |
| - requirements: |
13 |
| - - bw (command line utility) |
14 |
| - - be logged into bitwarden |
15 |
| - - bitwarden vault unlocked |
16 |
| - - E(BW_SESSION) environment variable set |
17 |
| - short_description: Retrieve secrets from Bitwarden |
18 |
| - version_added: 5.4.0 |
| 8 | +DOCUMENTATION = r""" |
| 9 | +name: bitwarden |
| 10 | +author: |
| 11 | + - Jonathan Lung (@lungj) <[email protected]> |
| 12 | +requirements: |
| 13 | + - bw (command line utility) |
| 14 | + - be logged into bitwarden |
| 15 | + - bitwarden vault unlocked |
| 16 | + - E(BW_SESSION) environment variable set |
| 17 | +short_description: Retrieve secrets from Bitwarden |
| 18 | +version_added: 5.4.0 |
| 19 | +description: |
| 20 | + - Retrieve secrets from Bitwarden. |
| 21 | +options: |
| 22 | + _terms: |
| 23 | + description: Key(s) to fetch values for from login info. |
| 24 | + required: true |
| 25 | + type: list |
| 26 | + elements: str |
| 27 | + search: |
| 28 | + description: |
| 29 | + - Field to retrieve, for example V(name) or V(id). |
| 30 | + - If set to V(id), only zero or one element can be returned. Use the Jinja C(first) filter to get the only list element. |
| 31 | + - If set to V(None) or V(''), or if O(_terms) is empty, records are not filtered by fields. |
| 32 | + type: str |
| 33 | + default: name |
| 34 | + version_added: 5.7.0 |
| 35 | + field: |
| 36 | + description: Field to fetch. Leave unset to fetch whole response. |
| 37 | + type: str |
| 38 | + collection_id: |
| 39 | + description: |
| 40 | + - Collection ID to filter results by collection. Leave unset to skip filtering. |
| 41 | + - O(collection_id) and O(collection_name) are mutually exclusive. |
| 42 | + type: str |
| 43 | + version_added: 6.3.0 |
| 44 | + collection_name: |
19 | 45 | description:
|
20 |
| - - Retrieve secrets from Bitwarden. |
21 |
| - options: |
22 |
| - _terms: |
23 |
| - description: Key(s) to fetch values for from login info. |
24 |
| - required: true |
25 |
| - type: list |
26 |
| - elements: str |
27 |
| - search: |
28 |
| - description: |
29 |
| - - Field to retrieve, for example V(name) or V(id). |
30 |
| - - If set to V(id), only zero or one element can be returned. |
31 |
| - Use the Jinja C(first) filter to get the only list element. |
32 |
| - - If set to V(None) or V(''), or if O(_terms) is empty, records are not filtered by fields. |
33 |
| - type: str |
34 |
| - default: name |
35 |
| - version_added: 5.7.0 |
36 |
| - field: |
37 |
| - description: Field to fetch. Leave unset to fetch whole response. |
38 |
| - type: str |
39 |
| - collection_id: |
40 |
| - description: |
41 |
| - - Collection ID to filter results by collection. Leave unset to skip filtering. |
42 |
| - - O(collection_id) and O(collection_name) are mutually exclusive. |
43 |
| - type: str |
44 |
| - version_added: 6.3.0 |
45 |
| - collection_name: |
46 |
| - description: |
47 |
| - - Collection name to filter results by collection. Leave unset to skip filtering. |
48 |
| - - O(collection_id) and O(collection_name) are mutually exclusive. |
49 |
| - type: str |
50 |
| - version_added: 10.4.0 |
51 |
| - organization_id: |
52 |
| - description: Organization ID to filter results by organization. Leave unset to skip filtering. |
53 |
| - type: str |
54 |
| - version_added: 8.5.0 |
55 |
| - bw_session: |
56 |
| - description: Pass session key instead of reading from env. |
57 |
| - type: str |
58 |
| - version_added: 8.4.0 |
59 |
| - result_count: |
60 |
| - description: |
61 |
| - - Number of results expected for the lookup query. Task will fail if O(result_count) |
62 |
| - is set but does not match the number of query results. Leave empty to skip this check. |
63 |
| - type: int |
64 |
| - version_added: 10.4.0 |
| 46 | + - Collection name to filter results by collection. Leave unset to skip filtering. |
| 47 | + - O(collection_id) and O(collection_name) are mutually exclusive. |
| 48 | + type: str |
| 49 | + version_added: 10.4.0 |
| 50 | + organization_id: |
| 51 | + description: Organization ID to filter results by organization. Leave unset to skip filtering. |
| 52 | + type: str |
| 53 | + version_added: 8.5.0 |
| 54 | + bw_session: |
| 55 | + description: Pass session key instead of reading from env. |
| 56 | + type: str |
| 57 | + version_added: 8.4.0 |
| 58 | + result_count: |
| 59 | + description: |
| 60 | + - Number of results expected for the lookup query. Task will fail if O(result_count) is set but does not match the number |
| 61 | + of query results. Leave empty to skip this check. |
| 62 | + type: int |
| 63 | + version_added: 10.4.0 |
65 | 64 | """
|
66 | 65 |
|
67 |
| -EXAMPLES = """ |
| 66 | +EXAMPLES = r""" |
68 | 67 | - name: "Get 'password' from all Bitwarden records named 'a_test'"
|
69 | 68 | ansible.builtin.debug:
|
70 | 69 | msg: >-
|
|
111 | 110 | {{ lookup('community.general.bitwarden', 'a_test', result_count=1) }}
|
112 | 111 | """
|
113 | 112 |
|
114 |
| -RETURN = """ |
115 |
| - _raw: |
116 |
| - description: |
117 |
| - - A one-element list that contains a list of requested fields or JSON objects of matches. |
118 |
| - - If you use C(query), you get a list of lists. If you use C(lookup) without C(wantlist=true), |
119 |
| - this always gets reduced to a list of field values or JSON objects. |
120 |
| - type: list |
121 |
| - elements: list |
| 113 | +RETURN = r""" |
| 114 | +_raw: |
| 115 | + description: |
| 116 | + - A one-element list that contains a list of requested fields or JSON objects of matches. |
| 117 | + - If you use C(query), you get a list of lists. If you use C(lookup) without C(wantlist=true), this always gets reduced |
| 118 | + to a list of field values or JSON objects. |
| 119 | + type: list |
| 120 | + elements: list |
122 | 121 | """
|
123 | 122 |
|
124 | 123 | from subprocess import Popen, PIPE
|
|
0 commit comments