netapp.ontap.iso8601_duration_from_seconds 过滤器 – 将秒数编码为 ISO 8601 持续时间字符串
注意
此过滤器插件是 netapp.ontap 集合(版本 22.13.0)的一部分。
如果您正在使用 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install netapp.ontap
。
要在 Playbook 中使用它,请指定:netapp.ontap.iso8601_duration_from_seconds
。
netapp.ontap 21.24.0 中的新增功能
概要
将秒数编码为 ISO 8601 持续时间字符串。
输入
这描述了过滤器的输入,即 | netapp.ontap.iso8601_duration_from_seconds
之前的值。
参数 |
注释 |
---|---|
要编码的秒数。 |
关键字参数
这描述了过滤器的关键字参数。这些是以下示例中的值 key1=value1
、key2=value2
等:input | netapp.ontap.iso8601_duration_from_seconds(key1=value1, key2=value2, ...)
参数 |
注释 |
---|---|
isodate.duration_isoformat 的可选格式字符串。默认为 P%P。 |
说明
注意
需要 isodate 和 datetime Python 模块。
在 ansible.cfg 中将 filter_plugins 路径设置为 <installation_path>/ansible_collections/netapp/ontap/plugins/filter。
可以使用支持“-t filter”的 ansible-doc (2.14) 版本在本地生成文档
ansible-doc -t filter netapp.ontap.iso8601_duration_to_seconds
示例
# Encode seconds
iso_duration: "{{ 59579864 | netapp.ontap.iso8601_duration_from_seconds }}"
# Encode 'duration_in_seconds' variable
iso_duration: "{{ duration_in_seconds | netapp.ontap.iso8601_duration_from_seconds }}"
返回值
键 |
描述 |
---|---|
表示 ISO 8601 格式持续时间的字符串。 返回:成功 |