Does field2's value display correctly if you use the full path to the other 
variable?

---
- hosts: localhost
  vars:
    record:
      field1: 1
      field2: "{{*record.*field1}}"
  tasks:
   - name: This one does not work
     debug: msg="{{record.field2}}"


On Wednesday, July 20, 2016 at 10:50:00 PM UTC-5, David Wong wrote:
>
> Hi John
>
> Thank for your reply, do you mean quoting like this:
>
> ---
> - hosts: localhost
>   vars:
>     record:
>       field1: 1
>       field2: "{{field1}}"
>   tasks:
>    - name: This one does not work
>      debug: msg="{{record.field2}}"
> ...
>
> I still get error:
>
> fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' 
> has an invalid value, which appears to include a variable that is 
> undefined. The error was: {u'field2': u'{{field1}}', u'field1': 1}: 
> 'field1' is undefined\n\nThe error appears to have been in 'xxxxx.yml': 
> line 8, column 6, but may\nbe elsewhere in the file depending on the exact 
> syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n   - 
> name: This one does not work\n     ^ here\n"}
>
>
> On Thursday, July 21, 2016 at 3:43:16 AM UTC+8, [email protected] 
> wrote:
>>
>>
>> On Friday, July 15, 2016 at 7:59:05 PM UTC-4, David Wong wrote:
>>>
>>> myapp:
>>>   version: 1.2
>>>   path: xxxx_{{version}
>>>
>>  
>> I do this all the time, but I always quote the RHS of each assignment. 
>>  NOTE also that you are missing a closing brace in your example code.
>>
>> John
>>
>

-- 
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/0321fc98-43ab-4ada-8d3a-63f506283ef2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to