Variables are lazy loaded so :

vars:
  x: '{{ x + [1] }}'

will not work since the value of x is not known before you try to use
x creating a self referential loop.

But you can get around it with `set_fact` as we evaluate variables at
the time of module execution and set_fact is a module that sets a new
variable:

set_fact:
    x : '{{ x + [1] }}'

this defines a 'new x' that is the 'old x + [1]' (add a list with the
number 1 as an element, assumes x is already a list, you might use
|default([]) if you are not assured x was previously defined


----------
Brian Coca

-- 
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/CACVha7d%3DdaR55qZJo1Cs--GbnxK8w4L4%2B%2BOsXiV_vgTzK0t3%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to