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
。
community.general 5.2.0 中的新功能
概要
此模块使用 keyring Python 库 从操作系统的原生密钥环设置或删除给定服务和用户名的密码。
要求
以下要求需要在执行此模块的主机上满足。
keyring (Python 库)
gnome-keyring(应用程序 - 无头 Gnome 密钥环访问需要)
dbus-run-session(应用程序 - 无头 Gnome 密钥环访问需要)
参数
参数 |
注释 |
---|---|
用于解锁密钥环的密码。 |
|
服务的名称。 |
|
密码是否应该存在。 选择
|
|
要设置的密码。 |
|
属于服务的用户。 |
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完整 |
可以在 |
|
支持:无 |
在 diff 模式下,将返回已更改的内容(或可能需要在 |
示例
- name: Set a password for test/test1
community.general.keyring:
service: test
username: test1
user_password: "{{ user_password }}"
keyring_password: "{{ keyring_password }}"
- name: Delete the password for test/test1
community.general.keyring:
service: test
username: test1
user_password: "{{ user_password }}"
keyring_password: "{{ keyring_password }}"
state: absent