I want to use Ansible for updating Jenkins plugins. So I download the
update information via curl. I do not want to do this every time I run
the playbook but only when the downloaded file is stale, say older
than one day.

I know how to get the stat of the file:
- name: Check Jenkins plugin data is not too old.
     path: /var/lib/jenkins/updates/default.json
   register: jenkins_updates_json_stat

Now I want to execute the download and update steps only when
jenkins_updates_json_stat.stat.ctime + 86400 < time.time()

Is there a simple way to get the current time in Ansible?

Regards Mirko
https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen)

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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK8jvqy%2Bqms-C7KrkC%2BMoYc-iFG00dmjrGMUJkgzzvv5ac7r1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedJan 3, '15 at 9:20p
activeJan 4, '15 at 8:25p

2 users in discussion

Mirko Friedenhagen: 2 posts Tom Bamford: 1 post



site design / logo © 2022 Grokbase