calculate from facts

hi,

i would like to calculate 75% from from my memory
if i read my pc memory from facts i can calculate it by multiplying it by 0.75
but that number will not always be a round number sometimes it will be a float

is there anyway to calculate the facts and drop what is behind the period ?

something like {{ansible_memory * 0.75|int }} ?

Also, take a look at the “set_fact” module…

I’m actually using this in a template, however the behavior is not as expected:

someVar = {{ ansible_memtotal_mb / 4|int }}

The result is ‘256.0’, same when I remove the |int and same when I do * 0.25.

The precedence of the “|” is high in Jinja2. You’ll need some parenthesis.