# \[WARNING\]: While constructing a mapping from /etc/ansible/playbooks/touch.yml, line 2, column 3, found a duplicate dict key (tasks). Using last defined value only.

**URL:** <https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524>\
**Category:** Ansible Project\
**Created:** [May 19, 2017, 2:38pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524 "2017-05-19T14:38:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [May 19, 2017, 2:38pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524/1 "2017-05-19T14:38:18Z")

</div>

I have the following playbook and I got the above error. This created the directory but not the file. Any ideas?

---

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [May 19, 2017, 2:43pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524/2 "2017-05-19T14:43:35Z")

</div>

When I comment out the directory piece and run it again, ansible will create the file

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 19, 2017, 2:56pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524/3 "2017-05-19T14:56:29Z")

</div>

You can only have one tasks: in a play.  
And as the message say only the last one will be executed.

So this is the correct syntax.

---

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [May 19, 2017, 3:03pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524/4 "2017-05-19T15:03:24Z")

</div>

Only one task for each playbook? Didnt know that

---

<div class="post-metadata">

**Author:** ![Anfield](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Anfield](https://forum.ansible.com/u/Anfield)\
**Post date:** [May 19, 2017, 3:05pm UTC](https://forum.ansible.com/t/warning-while-constructing-a-mapping-from-etc-ansible-playbooks-touch-yml-line-2-column-3-found-a-duplicate-dict-key-tasks-using-last-defined-value-only/24524/5 "2017-05-19T15:05:42Z")

</div>

Ok, nevermind. Only one instance of the tasks:, but multiple tasks underneath. Thanks!
