I am not clear about what you are trying to achieve here. are you using XYZ 
in with_items? Please note you have to quote src and dest in XYZ otherwise 
Ansible will treat src/dest are variables.  

On Tuesday, November 13, 2018 at 2:28:55 PM UTC+5:30, Mohan L wrote:
>
>
> I am not clear about what you are trying to achieve here. are you using 
> XYZ in with_items? Please note you have to quote src and dest in XYZ other 
> Ansible will src/dest are variables.  
>
> On Tuesday, November 13, 2018 at 2:14:25 PM UTC+5:30, 
> [email protected] wrote:
>>
>> Please find the files below.
>>
>>
>> *vars/main.yml*
>>
>> XYZ:
>> - { src: '/tmp/abc/ab.warr', dest: '/tmp/abc/' }
>>
>> TAR:
>> - { "src_tar": "/tmp/xx/sample.tar.gz", "dest_tar": "/tmp/sss/" }
>>
>> *tasks/main.yml*
>>
>> ---
>> - hosts: all
>>   vars_files:
>>       - /etc/ansible/xxx/xyz/vars/main.yml
>>   tasks:
>>   - name: test
>>     unarchive:
>>       src: "{{ item.src_tar }}"
>>       dest: "{{ item.dest_tar }}"
>>     with_items: "{{ TAR }}"
>>
>>
>> On Tuesday, November 13, 2018 at 2:06:40 PM UTC+5:30, Mohan L wrote:
>>>
>>>
>>> It looks like again you are not placing quotes around dictionary key. 
>>> Can you please show your code which through this error?
>>>
>>> On Tuesday, November 13, 2018 at 12:53:39 PM UTC+5:30, 
>>> [email protected] wrote:
>>>>
>>>> It is unpacking a tar file successfully but at the same time I am 
>>>> getting below error. Could you please help.
>>>>
>>>>
>>>>  {"msg": "The task includes an option with an undefined variable. The 
>>>> error was: 'dict object' has no attribute 'dest_tar'\n\nThe error appears 
>>>> to have been in '/etc/ansible/xxx/xy/tasks/main.yml': line 26, column 5, 
>>>> but may\nbe elsewhere in the file depending on the exact syntax 
>>>> problem.\n\nThe offending line appears to be:\n\n\n  - name: test\n    ^ 
>>>> here\n"}
>>>>
>>>

-- 
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/7afcb4b4-3602-4e51-bfc0-28a1cdcc4e41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to