linuxfabrik / linuxfabrik.ansible_mlp / 1.0.1 / lookup / bitwarden_item Returns a password item from Bitwarden. If no password item is found, a new item is created. | "added in version" 1.0.0 of linuxfabrik.ansible_mlp" Authors: Linuxfabrik GmbH, Zurich, Switzerland, https://www.linuxfabrik.chlinuxfabrik.ansible_mlp.bitwarden_item (1.0.1) — lookup
Install with ansible-galaxy collection install linuxfabrik.ansible_mlp:==1.0.1
collections: - name: linuxfabrik.ansible_mlp version: 1.0.1
This Ansible lookup plugin returns a password item from Bitwarden by searching for an item by name or by an item ID. If no password item is found, a new item is created.
If you do not specify a Bitwarden ID, a search by the name/title is performed. If a search by name returns multiple entries, this lookup plugin throws an error.
On success, this lookup plugin returns the complete Bitwarden item object.
If you don't specify a name/title for a password item, a name/title will be created automatically, using C(hostname - purpose), C(hostname - purpose) or just C(hostname) (depending on what is provided).
- name: 'The normal way using this lookup plugin. Search for the Bitwarden item using hostname, purpose and username. If not found, creates a new item called `appsrv01 - MariaDB`. Returns the password item.' ansible.builtin.debug: msg: "{{ lookup('bitwarden_item', { 'hostname': 'appsrv01', 'purpose': 'MariaDB', 'username': 'mariadb-monitoring', }, ) }}"
- name: 'Lookup by name. If not found, creates the item `appsrv01 - MariaDB`.' ansible.builtin.debug: msg: "{{ lookup('bitwarden_item', { 'name': 'appsrv01 - MariaDB', }, ) }}"
- name: 'Lookup by ID' ansible.builtin.debug: msg: "{{ lookup('bitwarden_item', { 'id': '580faed0-1841-4520-9d25-ebfcaba7db61', }, ) }}"
- name: 'Lookup (fully-fledged example)' ansible.builtin.debug: msg: "{{ lookup('bitwarden_item', { 'hostname': 'appsrv74', 'purpose': 'MariaDB', 'username': 'mariadb-admin', 'organization_id': '753d973d-49f3-4500-858a-9c509cd1d3c6', 'collection_ids': [ 'd7492405-2752-4f31-afeb-0d58a8a68565', 'ec2be63e-a156-4d60-90c8-e85ea73ddbb9' ], 'password_length': 60, 'password_uppercase': True, 'password_lowercase': True, 'password_numeric': False, 'password_special': False, 'notes': 'Please be careful.', 'uris': [ 'https://www.example.com', 'https://packages.example.com', ], }, ) }}"
- name: 'Lookup multiple items at once' ansible.builtin.debug: msg: "{{ lookup('bitwarden_item', { 'hostname': 'appsrv03', 'purpose': 'MariaDB', 'username': 'mariadb-admin', 'organization_id': '23a3534a-c4ef-4f2f-9cd4-e9f373e5438f', 'collection_ids': [ 'd67b1c1c-ce2e-41e5-8e04-8e00a8b596a6' ], }, { 'hostname': 'appsrv04', 'purpose': 'MariaDB', 'username': 'mariadb-admin', 'organization_id': '0729dfcb-5147-4725-a100-a2d1e9f92aca', 'collection_ids': [ 'b21194af-8615-42e2-84a6-82c938fb8b46' ], }, ) }}"
id: default: None description: If specified, searches for the specified item ID instead of the name. required: false type: str name: default: None description: Name/Title of the password item. If set, automatic name/title generation is switched off. required: false type: str uris: default: None description: List of URIs on the password item. required: false type: list notes: default: Generated by Ansible. description: Any notes on the password item. required: false type: str purpose: default: None description: The purpose of the password. Used for automatic name/title generation if name is not specified. required: false type: str hostname: default: None description: Hostname to which the password belongs. Used for automatic name/title generation if I(name) is not specified. required: false type: str username: default: None description: Username to which the password belongs. required: false type: str folder_id: default: None description: Bitwarden folder ID in which the password item must be stored. required: false type: list collection_ids: default: None description: List of Bitwarden collections in which the password item must be stored. required: false type: list organization_id: default: None description: Bitwarden Organization ID to which the password item belongs. required: false type: str password_length: default: 40 description: Password length for automatic password generation. required: false type: int password_numeric: default: true description: Include numeric characters for automatic password generation. required: false type: bool password_special: default: false description: Include special characters for automatic password generation. required: false type: bool password_lowercase: default: true description: Include lowercase characters for automatic password generation. required: false type: bool password_uppercase: default: true description: Include uppercase characters for automatic password generation. required: false type: bool
collectionIds: description: List of collection IDs in which the item was found. returned: always sample: - f3a23438-10b3-4b1d-9429-5e8ce64f585c type: list favorite: description: TODO returned: always sample: false type: bool folderId: description: Bitwarden folder ID in which the item was found. returned: always sample: 5634fa7e-db14-40a2-aca0-26794301c223 type: str id: description: Bitwarden password item ID. returned: always sample: 1b49066e-43f6-4ab5-9071-09f353aef3b3 type: str login: contains: password: description: The password. returned: always sample: 6VuIkoKQmCl9Yyv3xpgjU6SF2ecs6k type: str passwordRevisionDate: description: The last time the password was changed. returned: always sample: None type: str totp: description: TOTP returned: always sample: 634990 type: str uris: contains: match: description: Match algorithm. returned: always sample: None type: int uri: description: The URL. returned: always sample: https://www.example.com type: str description: A list of Bitwarden URI objects (dictionaries). returned: always type: complex username: description: Username to which the password belongs. returned: always sample: root type: str description: A Bitwarden login object (dictionary). returned: always type: dict name: description: Name/Title of the password item. returned: always sample: appsrv01 - MariaDB type: str notes: description: Some notes about the cipher. If C(notes) is empty, this lookup plugin always sets C(Automatically generated by Ansible.). returned: always sample: Automatically generated by Ansible. type: str object: description: Type of the Bitwarden object. Always returns C(item). returned: always sample: item type: str organizationId: description: The ID of the organization. returned: always sample: 65dce53a-15eb-4116-a2e8-633507b917b7 type: str password: description: The password. Same as under the C(login) dict, but at a higher level for easier access. returned: always sample: 6VuIkoKQmCl9Yyv3xpgjU6SF2ecs6k type: str reprompt: description: TODO returned: always sample: 0 type: int revisionDate: description: Date/Time the item was created. returned: always sample: '2019-01-28T15:31:34.300Z' type: str type: description: TODO returned: always sample: 1 type: int username: description: Username to which the password belongs. Same as under the C(login) dict, but at a higher level for easier access. returned: always sample: root type: str