mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Improve docs of bitwarden lookup (#7727)
* Improve docs of bitwarden lookup. * Improve formulations. Co-authored-by: Don Naro <dnaro@redhat.com> * Improve formulation. --------- Co-authored-by: Don Naro <dnaro@redhat.com>
This commit is contained in:
parent
1fdbb50abb
commit
825bec7053
1 changed files with 15 additions and 9 deletions
|
@ -25,7 +25,10 @@ DOCUMENTATION = """
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
search:
|
search:
|
||||||
description: Field to retrieve, for example V(name) or V(id).
|
description:
|
||||||
|
- Field to retrieve, for example V(name) or V(id).
|
||||||
|
- 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.
|
||||||
type: str
|
type: str
|
||||||
default: name
|
default: name
|
||||||
version_added: 5.7.0
|
version_added: 5.7.0
|
||||||
|
@ -39,27 +42,27 @@ DOCUMENTATION = """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: "Get 'password' from Bitwarden record named 'a_test'"
|
- name: "Get 'password' from all Bitwarden records named 'a_test'"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'a_test', field='password') }}
|
{{ lookup('community.general.bitwarden', 'a_test', field='password') }}
|
||||||
|
|
||||||
- name: "Get 'password' from Bitwarden record with id 'bafba515-af11-47e6-abe3-af1200cd18b2'"
|
- name: "Get 'password' from Bitwarden record with ID 'bafba515-af11-47e6-abe3-af1200cd18b2'"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') }}
|
{{ lookup('community.general.bitwarden', 'bafba515-af11-47e6-abe3-af1200cd18b2', search='id', field='password') | first }}
|
||||||
|
|
||||||
- name: "Get 'password' from Bitwarden record named 'a_test' from collection"
|
- name: "Get 'password' from all Bitwarden records named 'a_test' from collection"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'a_test', field='password', collection_id='bafba515-af11-47e6-abe3-af1200cd18b2') }}
|
{{ lookup('community.general.bitwarden', 'a_test', field='password', collection_id='bafba515-af11-47e6-abe3-af1200cd18b2') }}
|
||||||
|
|
||||||
- name: "Get full Bitwarden record named 'a_test'"
|
- name: "Get list of all full Bitwarden records named 'a_test'"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'a_test') }}
|
{{ lookup('community.general.bitwarden', 'a_test') }}
|
||||||
|
|
||||||
- name: "Get custom field 'api_key' from Bitwarden record named 'a_test'"
|
- name: "Get custom field 'api_key' from all Bitwarden records named 'a_test'"
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: >-
|
msg: >-
|
||||||
{{ lookup('community.general.bitwarden', 'a_test', field='api_key') }}
|
{{ lookup('community.general.bitwarden', 'a_test', field='api_key') }}
|
||||||
|
@ -67,9 +70,12 @@ EXAMPLES = """
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
_raw:
|
_raw:
|
||||||
description: List of requested field or JSON object of list of matches.
|
description:
|
||||||
|
- A one-element list that contains a list of requested fields or JSON objects of matches.
|
||||||
|
- If you use C(query), you get a list of lists. If you use C(lookup) without C(wantlist=true),
|
||||||
|
this always gets reduced to a list of field values or JSON objects.
|
||||||
type: list
|
type: list
|
||||||
elements: raw
|
elements: list
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
Loading…
Reference in a new issue