community.general.krb_ticket 模块 – 用于管理票据的 Kerberos 工具
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.general.krb_ticket
。
community.general 10.0.0 中的新增功能
概要
使用
kinit
、klist
和kdestroy
基本实用程序管理 Kerberos 票据。请参阅 https://web.mit.edu/kerberos/krb5-1.12/doc/user/user_commands/index.html 以供参考。
要求
在执行此模块的主机上需要以下要求。
krb5-user 和 krb5-config 包
参数
参数 |
注释 |
---|---|
请求限制在主机本地地址或非限制的票据。 选择
|
|
请求匿名处理。 选择
|
|
使用 如果未使用此选项,则使用默认的缓存名称和位置。 默认的凭据缓存可能因系统而异。 如果未设置,则会改用 |
|
请求规范化主体名称,并允许 KDC 回复与请求不同的客户端主体。 选择
|
|
请求可转发或不可转发的票据。 选择
|
|
当 需要指定 |
|
请求具有生命周期的票据,如果未指定 指定比最大票据生命周期(由每个站点配置)更长的票据生命周期将不会覆盖配置的最大票据生命周期。
您不能混合单位; 请参阅 https://web.mit.edu/kerberos/krb5-1.12/doc/basic/date_format.html 以供参考。 |
|
主体密码。 需要指定 |
|
主体名称。 如果未设置,将使用运行此模块的用户。 |
|
请求可代理或不可代理的票据。 选择
|
|
请求可更新的票据,总生命周期等于
您不能混合单位; 请参阅 https://web.mit.edu/kerberos/krb5-1.12/doc/basic/date_format.html 以供参考。 |
|
请求更新票据授予票据。 请注意,即使票据仍在可更新生命周期内,过期的票据也无法更新。 选择
|
|
请求预先注明日期的票据。 签发带有无效标志的延期票证,在使用前需要重新提交给 KDC 进行验证。
您可以使用绝对时间格式,例如 您也可以使用类似于 请参阅 https://web.mit.edu/kerberos/krb5-1.12/doc/basic/date_format.html 以供参考。 |
|
Kerberos 票证的状态。
选择
|
|
请求将缓存中(带有无效标志)的票据授予票据传递给 KDC 进行验证。 如果票证在其请求的时间范围内,则缓存将替换为已验证的票证。 选择
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完全 |
可以在 |
|
支持: 无 |
在 diff 模式下,将返回已更改(或可能需要在 |
示例
- name: Get Kerberos ticket using default principal
community.general.krb_ticket:
password: some_password
- name: Get Kerberos ticket using keytab
community.general.krb_ticket:
keytab: true
keytab_path: /etc/ipa/file.keytab
- name: Get Kerberos ticket with a lifetime of 7 days
community.general.krb_ticket:
password: some_password
lifetime: 7d
- name: Get Kerberos ticket with a starting time of July 2, 2024, 1:35:30 p.m.
community.general.krb_ticket:
password: some_password
start_time: "240702133530"
- name: Get Kerberos ticket using principal name
community.general.krb_ticket:
password: some_password
principal: admin
- name: Get Kerberos ticket using principal with realm
community.general.krb_ticket:
password: some_password
principal: [email protected]
- name: Check for existence by ticket cache
community.general.krb_ticket:
cache_name: KEYRING:persistent:0:0
- name: Make sure default ticket is destroyed
community.general.krb_ticket:
state: absent
- name: Make sure specific ticket destroyed by principal
community.general.krb_ticket:
state: absent
principal: [email protected]
- name: Make sure specific ticket destroyed by cache_name
community.general.krb_ticket:
state: absent
cache_name: KEYRING:persistent:0:0
- name: Make sure all tickets are destroyed
community.general.krb_ticket:
state: absent
kdestroy_all: true