Hi,
I am running ansible on centos 7.4.1708 . Not sure what I am doing wrong but the dictionary variables are not completely written by the copy module.
Here is my complete YAML file :
Hi,
I am running ansible on centos 7.4.1708 . Not sure what I am doing wrong but the dictionary variables are not completely written by the copy module.
Here is my complete YAML file :
Because of the with_dict the task will run 3 times, one for each item in var_dict1.
Only the last will stick since the file will be overwritten.
Do this instead
- name: Copy the contents of var_dict1 to output1
copy:
content: |
{% for key, value in var_dict1.iteritems() %}
{{ key }} {{ value }}
{% endfor %}
dest: "/usershome/output1"
run_once: yes
Hi Kai,
Thanks that worked. Did not know about iteritems until now.
Regards,
Abey