Ansible - templates with items won't works

I run this in a ansible playbook for copy files from the directory "templates" of the ansible role and I get error...

- name:  "Copy templates"
templates: src={{item.src}} dest={{item.dest}}
with_items:
    - { src: 'tpl1', dest: '/etc/tpl1' }
    - { src: 'tpl2', dest: '/etc/tpl2' }
    - { src: 'tpl3', dest: '/etc/tpl3' }

Error Output:

ERROR! couldn't resolve module/action 'templates'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/myuser/Desktop/mydir/roles/rolename/tasks/main.yml': line 73, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name:  "Copy templates"
^ here

Can you help me?


Solution 1:

The module is named template, not templates.

- name: "Copy templates"
  template:
    src="{{item.src}}"
    dest="{{item.dest}}"