You are looking for the aptly named "round" filter: http://jinja.pocoo.org/docs/dev/templates/#round
some_val|round On Saturday, August 30, 2014, Mikael Sandström <[email protected]> wrote: > Hi, > > I've got a template which does a few calculations on memory (to set up > hugepages etc), and I need to round the result but I'm not sure how to. > > This is the expression: > > > "{{ (((60/100)* ansible_memtotal_mb)*1024)/2048 }}" > > > > > I usually end up with a decimal, but I need to get rid of the decimal: > > Result: 600.6 and I'd like to round that to 601 > > Result: 1201.1 should be rounded to 1201 > etc > > Any idea on how to do that? > > Thanks! > /M > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/7a9b2161-46d2-4484-b384-3ad52438065f%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/7a9b2161-46d2-4484-b384-3ad52438065f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz [email protected] http://sivel.net/ -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v_b%3D8nKh7dE%2BYF-a7%2BH4Q2SzO-%2Bngmv7EuNOVHLsHby9w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
