K
Size: a a a
K
K
AS
K
AS
SG
SG
AG
K
AG
r
AS
AG
ВИ
ВИ
ВИ
ВИ
K
r
prometheus_storage_retention_size: "{{(ansible_mounts | selectattr('mount', 'in', prometheus_db_dir) | list | sort(attribute='mount'))[-1]['size_total'] * 0.95 / 1048576 - 999 | int }}MB"
- тут int
применяется только к 999
и на выходе десятичная дробь.prometheus_storage_retention_size: "{{(ansible_mounts | selectattr('mount', 'in', prometheus_db_dir) | list | (sort(attribute='mount'))[-1]['size_total'] * 0.95 / 1048576 - 999) | int }}MB"
, то ошибка template error while templating string: expected token 'name', got '('
Так работает как хочется, но это некрасиво:prometheus_storage_retention_size_float: "{{ ansible_mounts | selectattr('mount', 'in', prometheus_db_dir) | list | (sort(attribute='mount'))[-1]['size_total'] * 0.95 / 1048576 - 999 }}"Как сделать без лишней переменной?
prometheus_storage_retention_size: "{{ prometheus_storage_retention_size_float | int }}MB"
ВИ