community.general.keyring 查找 – 从操作系统密钥环获取密钥
注意
此查找插件是 community.general 集合(版本 10.1.0)的一部分。
如果您使用的是 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此查找插件,请参阅 要求 以了解详细信息。
要在 playbook 中使用它,请指定:community.general.keyring
。
概要
允许您访问存储在操作系统提供的密钥环/密钥链中的数据。
要求
在执行此查找的本地控制器节点上需要以下要求。
keyring (python 库)
示例
- name: output secrets to screen (BAD IDEA)
ansible.builtin.debug:
msg: "Password: {{item}}"
with_community.general.keyring:
- 'servicename username'
- name: access mysql with password from keyring
community.mysql.mysql_db:
login_password: "{{ lookup('community.general.keyring', 'mysql joe') }}"
login_user: joe
返回值
键 |
描述 |
---|---|
存储的密钥。 返回:成功 |