onepassword – fetch field values from 1Password
New in version 2.6.
Synopsis
- onepassword wraps the
opcommand line utility to fetch specific field values from 1Password
Requirements
The below requirements are needed on the local master node that executes this lookup.
-
op1Password command line utility. See https://support.1password.com/command-line/ - must have already logged into 1Password using
opCLI
Parameters
| Parameter | Choices/Defaults | Configuration | Comments |
|---|---|---|---|
| _terms - / required | identifier(s) (UUID, name, or subdomain; case-insensitive) of item(s) to retrieve | ||
| field - | Default: "password" | field to return from each matching item (case-insensitive) | |
| section - | Default: "None" | item section containing the field to retrieve (case-insensitive); if absent will return first match from any section | |
| subdomain - added in 2.7 | Default: "None" | The 1Password subdomain to authenticate against. | |
| vault - | Default: "None" | vault containing the item to retrieve (case-insensitive); if absent will search all vaults | |
| vault_password - added in 2.7 | Default: "None" | The password used to unlock the specified vault. |
Examples
- name: Retrieve password for KITT
debug:
var: lookup('onepassword', 'KITT')
- name: Retrieve password for Wintermute
debug:
var: lookup('onepassword', 'Tessier-Ashpool', section='Wintermute')
- name: Retrieve username for HAL
debug:
var: lookup('onepassword', 'HAL 9000', field='username', vault='Discovery')
- name: Retrieve password for HAL when not signed in to 1Password
debug:
var: lookup('onepassword', 'HAL 9000', subdomain='Discovery', vault_password='DmbslfLvasjdl')
Return Values
Common return values are documented here, the following are the fields unique to this lookup:
| Key | Returned | Description |
|---|---|---|
| _raw - | field data requested |
Status
- This lookup is not guaranteed to have a backwards compatible interface. [preview]
- This lookup is maintained by the Ansible Community. [community]
Authors
- Scott Buchanan <sbuchanan@ri.pn>
- Andrew Zenk <azenk@umn.edu>
- Sam Doran<sdoran@redhat.com>
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/plugins/lookup/onepassword.html