hint: use replace filter :-) (To replace comma into dot)

{{ variable | replace(‘,’,’.’) }}  

Probably you’ll need to use set_fact as well.
 
Best,
Karol



> On 2 May 2018, at 15:21, belajzus <bruno.kurev...@gmail.com> wrote:
> 
> Hi,
> 
> I'm trying to filter files newer than some other file.
> 
> So, I list that file, get his creationtime, after that I calculate the 
> difference between the current time and the creation time of that file. That 
> is the difference in days between today and day when the file is created.
> 
> BUT, I work with fucking windows, and, there I got epoch with comma, not dot. 
> And I'm unable to calculate difference. If I try to get int valčue from 
> epoch, calculated value is zero.
> 
> For example, this is output of setup module on windows:
> 
>        "ansible_date_time": {
>             "date": "2018-05-02",
>             "day": "02",
>             "epoch": "1525275022,0416",
> 
> 
> My idea was to calculate before how much day file was created with following 
> formula:
> 
>       days_since_last_backup: "{{ ((current_epoch|int - 
> item.creationtime|int)/86400)|int }}"
> But I got negative value since ansible can't calculate integer value from 
> some variable which has comma in self. 
> 
> 
> So, is there some option to replace in variable/string comma with dot.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-devel+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to