title: Warning while constructing a mapping in Ansible
body: <p>Whenever I run my playbook the following warning comes up:</p>
  
  <blockquote>
    <p>[WARNING]: While constructing a mapping from /etc/ansible/roles/foo/tasks/main.yml, line 17, column 3, found
    a duplicate dict key (file).  Using last defined value only.</p>
  </blockquote>
  
  <p>The relevant part of my main.yml in the tasks folder is like this:</p>
  
  <p><em>(line 17 is the task to clean the files which seems a bit off so I guess the problem is with the previous "script" line)</em></p>
  
  <pre><code>- name: Run script to format output
    script: foo.py {{ taskname }} /tmp/fcpout.log
  - name: Clean temp files
    file: path=/tmp/fcpout.log state=absent
  </code></pre>
  
  <p>And my vars file:</p>
  
  <pre><code>---
  my_dict: {SLM: "114", Regular: "255", Production: "1"}
  taskid: "{{my_dict[taskname]}}"
  </code></pre>
  
  <p>To run my playbook I do:</p>
  
  <pre><code>ansible-playbook playbooks/foo.yml --extra-vars "server=bar taskname=SLM"
  </code></pre>
  
  <p>What I'm trying to do is to take the command line arguments, set the hosts: with the "server" parameter, get the taskname and from that find out to which id refers to. This id is used as the first input to my python script which runs remotely.</p>
  
  <p>The playbook works fine, but I don't understand why I get a warning. Could anyone explain what is wrong here?</p>