netapp.ontap.iso8601_duration_from_seconds filter – Encode seconds as a ISO 8601 duration string
Note
This filter plugin is part of the netapp.ontap collection (version 22.12.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install netapp.ontap
.
To use it in a playbook, specify: netapp.ontap.iso8601_duration_from_seconds
.
New in netapp.ontap 21.24.0
Synopsis
Encode seconds as a ISO 8601 duration string.
Input
This describes the input of the filter, the value before | netapp.ontap.iso8601_duration_from_seconds
.
Parameter |
Comments |
---|---|
A number of seconds to encode. |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1
, key2=value2
and so on in the following
example: input | netapp.ontap.iso8601_duration_from_seconds(key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
An optional format string for isodate.duration_isoformat. Defaults to P%P. |
Notes
Note
requires isodate and datetime python modules.
set filter_plugins path to <installation_path>/ansible_collections/netapp/ontap/plugins/filter in ansible.cfg.
documentation can be generated locally using a version of ansible-doc (2.14) that supports ‘-t filter’
ansible-doc -t filter netapp.ontap.iso8601_duration_to_seconds
Examples
# 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 }}"
Return Value
Key |
Description |
---|---|
A string representing the duration in ISO 8601 format. Returned: success |