Ansible copy module with items
<p>I Just setup and ansible testing server and trying copy module to copy files over multiple hosts following a ssh service to be started. But its throwing error. please advise what wrong i am doing here..</p>

<pre><code>---
- hosts: Dummy_host
  remote_user: root
  tasks:
      - name: Copying Files to Group of Hosts
        copy: src=/tmp/{{ item.sname }} dest=/tmp/WWW/{{ item.dname }}
        notify:
           - restart sshd
        with_items:
           - { sname: file1.txt, dname: nm1.txt }
           - { sname: file2.txt, dname: nm2.txt }
  handlers:
       - name: restart sshd
         service: name=sshd state=restarted
</code></pre>

<p>Below is the Error</p>

<pre><code>root@test1# ansible-playbook  cp4.yml
ERROR! Syntax Error while loading YAML.


The error appears to have been in '/etc/ansible/Playbooks/cp4.yml': line 9, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

           - restart sshd
        with_items:
^ here
</code></pre>