Lookup variable strange behaviour

This is fixed in Ansible's 1.1 development branch.

The workaround for anyone who does not yet want to upgrade, is to
upgrade, but failing that, you can use the "with_file" or "with_env"
version instead and just reference the array when you use it.

Thanks for help.
Is evaluating $LOOKUP again on every use of the variable holding it part of this?
The date keeps changing, quite annoyingly.

Evaluation is meant to be lazy.

We can pretty easily make an option to cache.

Can you file a github ticket so we don't forget?

Assume you are using $PIPE ?

Thanks!

Here it goes: https://github.com/ansible/ansible/issues/2108

Again thanks for help!
BTW Ansible rocks.

+1, great feature.

Tomek,

This is what we currently do (you could use this as a workaround until the
feature lands):

  tasks:
  - name: get the current time for a timestamp
    local_action: command date +%Y%m%d-%H%M%S
    register: time

Then we use ${time.stdout} where we need the timestamp variable.

Take care,

Lorin

  tasks:
  - name: get the current time for a timestamp
    local_action: command date +%Y%m%d-%H%M%S
    register: time

Good idea.

This will still result in a different time per node, but not if you
select the time from a particular host via hostvars.

Give me an hour, but it should be less. Set your stopwatches :slight_smile:

Done, here's my test playbook. I'm not sure i'm crazy about this
useful cache logic not being accessible to ALL lookup plugins, so we
may generalize the "with_*_once" behavior later so the caching is done
at a higher level.

I'll file a ticket to do so, though this works now and we'll keep this syntax.

My watch says 11 minutes :slight_smile:

--Michael

That was fast. I went out for dinner and came back to see this done.

It works like charm now. Kudos to you Michael.

Once again thanks for help!

I’ve found bug in this, please see comment on the github issue.

Yeah, if tasks have names it doesn't quite work right. I'll figure
it out, if others want to beat me to it, go ahead. Working on some
other things first.