I recently started writing playbooks. Below is my task:
- name: apache templates
template:
src: "{{ item.templatename }}"
dest: /opt/apache/default/"{{ item.config }}"
loop:
- { templatename: 'apache_webconf.j2', config: 'web.conf' }
- { templatename: 'apache_sitesconf.j2', config: 'sites.conf' }
What i am trying to achieve here is that ansible should replace template with web.conf at destination. However, ansible is throwing the below error while running the playbook.
ERROR! The field 'loop' is supposed to be a string type, however the incoming data structure is a <class 'ansible.parsing.yaml.objects.AnsibleSequence'>