Hello,

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.
  stat:
    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
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen)
https://bitbucket.org/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 [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/CAK8jvqy%2Bqms-C7KrkC%2BMoYc-iFG00dmjrGMUJkgzzvv5ac7r1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to