human_readable¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in versionhistorical.
Synopsis¶
- Convert byte or bit figures to more human-readable formats.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input int required |
Number of bytes, or bits. Depends on O(isbits). | |
| isbits bool |
Whether the input is bits, instead of bytes. | |
| unit str |
Choices: Y, Z, E, P, T, G, M, K, B | Unit to force output into. If none specified the largest unit arrived at will be used. |
Examples¶
# size => "1.15 GB"
size: "{{ 1232345345 | human_readable }}"
# size => "1.15 Gb"
size_bits: "{{ 1232345345 | human_readable(true) }}"
# size => "1175.26 MB"
size_MB: "{{ 1232345345 | human_readable(unit='M') }}"
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | str | human-readable byte or bit size. |