Hi Team,
I am trying to unarchive a file is failing with below errors. Could someone please look into it.
Playbook:
Hi Team,
I am trying to unarchive a file is failing with below errors. Could someone please look into it.
Playbook:
You have to quote the dictionary key as well.
FROM
TO
Here is the working example. If you write a role and call that role from playbook then you no need to use var_files section. vars/main.yml is one of the default ansible search path.
See how my tasks/main.yml :
Thank you Mohan that worked for me, but may I know why we need to place them in double quotes??
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”}
Ansible think src_tar as variable If you don’t place quotes so through error saying undefined variable.
It looks like again you are not placing quotes around dictionary key. Can you please show your code which through this error?
Please find the files below.
vars/main.yml
XYZ:
TAR:
tasks/main.yml
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.
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.