I am using ansible 2.9 and trying to use ansible loop instead of with_dict. I am getting below error. I need to pass the values at the task, I can't keep them in variable or load them at the beginning. do I need to switch back to with_dict?
fatal: [localhost]: FAILED! => {"msg": "template error while templating string: expected token 'end of print statement', got ':'. String: {{ key:/var/tmp/h vaule:/tmp/h|dict2items }}"}
- name: copy module
copy:
src: "{{ item.key }}"
dest: "{{ item.value}}"
loop:
- "{{ key: /var/tmp/a value:/tmp/h |dict2items }}"
- "{{ key: /var/tmp/b value:/tmp/z |dict2items }}"