community.general.to_months filter – Converte a duration string to months
Note
This filter plugin is part of the community.general collection (version 9.5.1).
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 community.general
.
To use it in a playbook, specify: community.general.to_months
.
New in community.general 0.2.0
Synopsis
Parse a human readable time duration string and convert to months.
Input
This describes the input of the filter, the value before | community.general.to_months
.
Parameter |
Comments |
---|---|
The time string to convert. Can use the units Valid strings are space separated combinations of an integer with an optional minus sign and a unit. Examples are |
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 | community.general.to_months(key1=value1, key2=value2, ...)
Parameter |
Comments |
---|---|
Number of days per month. Default: |
|
Number of days per year. Default: |
Examples
- name: Convert a duration into months
ansible.builtin.debug:
msg: "{{ '1y 7m 5d 30h' | community.general.to_months }}"
Return Value
Key |
Description |
---|---|
Number of months. Returned: success |