community.general.lastpass 查找 – 从 LastPass 获取数据

注意

此查找插件是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general。您需要其他要求才能使用此查找插件,请参阅 要求了解详细信息。

要在 playbook 中使用它,请指定: community.general.lastpass

概要

  • 使用 lpass 命令行实用程序从 LastPass 获取特定字段。

要求

需要在执行此查找的本地控制器节点上满足以下要求。

  • lpass(命令行实用程序)

  • 必须已经登录到 LastPass

术语

参数

注释

术语

list / elements=string / required

要从中检索字段的密钥。

关键字参数

这描述了查找的关键字参数。这些值是 key1=value1key2=value2 等,在以下示例中:lookup('community.general.lastpass', key1=value1, key2=value2, ...)query('community.general.lastpass', key1=value1, key2=value2, ...)

参数

注释

field

string

要从 LastPass 返回的字段。

默认值: "password"

注释

注意

  • 当关键字参数和位置参数一起使用时,位置参数必须列在关键字参数之前:lookup('community.general.lastpass', term1, term2, key1=value1, key2=value2)query('community.general.lastpass', term1, term2, key1=value1, key2=value2)

示例

- name: get 'custom_field' from LastPass entry 'entry-name'
  ansible.builtin.debug:
    msg: "{{ lookup('community.general.lastpass', 'entry-name', field='custom_field') }}"

返回值

描述

返回值

list / elements=string

存储的机密

已返回:成功

作者

  • Andrew Zenk

提示

每个条目类型的配置条目都具有从低到高的优先级顺序。例如,列表中较低的变量将覆盖列表中较高的变量。