On Sunday, July 10, 2016 at 3:41:55 PM UTC-4, Kai Stian Olstad wrote:
>
> On 09. juli 2016 04:03, [email protected] <javascript:> wrote: 
> > > I have what seems to be a simple question that I can't find on the 
> web.  How do I get the current date from the Ansible server into a J2 
> variable?  I know how to do it with {{ ansible_date_time.date }} but that's 
> from the remote node at the time Ansible collected facts (which could be 
> cached), NOT "now" on the server I'm running on...right? 
> >
> > Check out lookups 
> > https://docs.ansible.com/ansible/playbooks_lookups.html 
> <https://docs.ansible.com/ansible/playbooks_lookups.html> 
> >
> > {{ lookup('pipe','date') }} 
>
> Thanks.  I should have mentioned I considered that, but it seems crazy and 
> inefficient to have to shell out and run the `date` command when Python, 
> Ansible and J2 already know what date and time it is...I just need a way to 
> make one of them tell me in a playbook.  Is there really no way to do 
> something like {{ now.strftime('%Y-%m-%d') }}?
>

-- 
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/be7f2ec0-8265-4ef2-acd2-bfaba230d8de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to