# win\_regedit  "found a duplicate dict key"

**URL:** <https://forum.ansible.com/t/win-regedit-found-a-duplicate-dict-key/22974>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 7, 2016, 5:51pm UTC](https://forum.ansible.com/t/win-regedit-found-a-duplicate-dict-key/22974 "2016-11-07T17:51:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_Schaal](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Todd\_Schaal](https://forum.ansible.com/u/Todd_Schaal)\
**Post date:** [November 7, 2016, 5:51pm UTC](https://forum.ansible.com/t/win-regedit-found-a-duplicate-dict-key/22974/1 "2016-11-07T17:51:35Z")

</div>

I get the warning “found a duplicate dict key” when trying to modify multiple values under a single key. What’s the appropriate way to do this? I’ve tried using separate tasks or using a like as below, but I still get the same message:

- name: Miscellaneous Security Settings  
win\_regedit:  
key: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system  
value: “{{item.value}}”  
data: “{{item.data}}”  
datatype: “{{item.datatype}}”  
with\_items:
- value : dontdisplaylastusername  
data: 1  
datatype: dword
- vlaue: legalnoticecaption  
data: Warning  
datatype: string  
win\_regedit:  
key: HKLM:\SYSTEM\CurrentControlSet\Control\Lsa  
vlaue: restrictanonymous  
data: 1  
datatype: dword  
win\_regedit:  
key: HKLM:\SYSTEM\CurrentControlSet\Control\Lsa  
vlaue: restrictanonymoussam  
data: 1  
datatype: dword

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 7, 2016, 8:16pm UTC](https://forum.ansible.com/t/win-regedit-found-a-duplicate-dict-key/22974/2 "2016-11-07T20:16:56Z")

</div>

Each module call must be in it’s own task block. Effectively a task block is indicated with a hyphen under tasks. In your case, you specify `-name: Miscellaneous Security Settings` as a task block with 3 calls to win\_regedit.

You will need to make each win\_regedit call it’s own task.

---

<div class="post-metadata">

**Author:** ![Todd\_Schaal](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Todd\_Schaal](https://forum.ansible.com/u/Todd_Schaal)\
**Post date:** [November 7, 2016, 9:06pm UTC](https://forum.ansible.com/t/win-regedit-found-a-duplicate-dict-key/22974/3 "2016-11-07T21:06:12Z")

</div>

That did the trick thanks for your help!
