I have a YAML structure describing a set of usergroups, one of the elements being a list of usernames. I'm trying to design simple filters or tasks that replace the sub-element of this list of members in each group by a new one.

Executing the following playbook:

```yaml
- hosts: localhost
  become: no

  vars:
    my_groups:
      group1:
        members: [alice, bob, john]
        comment: first group
        sudoers: yes
      group2:
        members: [alice, john]
        comment: second group
        sudoers: no
    new_users_list: [alice, bob]

  tasks:
  - set_fact:
      new_members: "{{ { 'members': new_users_list } }}"
  - debug:
      var: new_members
  - debug:
      msg: "{{ my_groups | map('combine', new_members ) }}"

```

gives the following result for the last task:

> 
> fatal: [localhost]: FAILED! => {"msg": "failed to combine variables, expected dicts but got a 'str' and a 'dict': \n"all"\n{"members": ["alice", "bob"]}"}
> 
> 
> 

I was expecting to see the replacement of the list `members` by the list given as parameter of combined filter. But now I understand I am wrong: not only the structure I try to combine lacks the level of the groupname but also, most of all, it seems that the `map` filter expects a list (or applies a `| list` filter).

How can I pass a a dict as an argument of the `combine` filter that `map` filter applies to each element of a dict?

Note that the task:

```yaml
- debug:
    var: new_members

```

Correctly interprets the variable as a dictionary:

```json
{
    "new_members": {
        "members": [
            "alice",
            "bob"
        ]
    }
}

```

My expected output is to intersect the existing member list with the new members one:

```yaml
my_groups:
  group1:
    comment: first group
    members:
      - alice
      - bob
    sudoers: true
  group2:
    comment: second group
    members:
      - alice
    sudoers: false

```