I know this is an inefficient way of doing it (besides it’s not working due to this error → found a duplicate dict key (win_regedit). Using
last defined value only) and same task can be achieved with Loops, and updated inside just one ‘win_regedit’ instance. Can someone help me with how I can do this via loops?. Thanks.
I suspect you don’t want ‘item.datatype’ in your with_items list - you only need item. when you are dereferencing the variable.
Not tested, but I think maybe something like this is what you are after. I changed subkey to location as it seems subkey has a special meaning in yaml.
Incidentally I use yamllint.com or a yaml-aware editor such as notepad++ to help get my syntax straight, that might help here.
Thanks, your syntax for listing the items under the "with_items’ section did the trick.
I wonder why listing as:
{location: ‘WindowsUpdate’, value: ‘WUServer’, data: ‘http://x.x.x.x:8530’, datatype: ‘string’}
was throwing an error.
So what can be done about the “found a duplicate dict key” message? Surely modifying multiple values under one key is a legitimate use case. How do you do it? I tried using 2 separate task and also a loop like below, but I always get the same message. What am I doing wrong?