# custom filter used in aggregate doesn't receive the correct list.

**URL:** <https://forum.ansible.com/t/custom-filter-used-in-aggregate-doesnt-receive-the-correct-list/30583>\
**Category:** Ansible Project\
**Created:** [June 17, 2019, 10:22am UTC](https://forum.ansible.com/t/custom-filter-used-in-aggregate-doesnt-receive-the-correct-list/30583 "2019-06-17T10:22:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Garcia\_Fern](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@Fernando\_Garcia\_Fern](https://forum.ansible.com/u/Fernando_Garcia_Fern)\
**Post date:** [June 17, 2019, 10:22am UTC](https://forum.ansible.com/t/custom-filter-used-in-aggregate-doesnt-receive-the-correct-list/30583/1 "2019-06-17T10:22:47Z")

</div>

Hello

I’m trying to use aggregates to speed up configuration of my Nexus switches.

I’m using a custom filter to generate a customized list of interfaces based on a “interfaces” list, defined in the group\_vars and host\_vars files (some of the resources defined in each of them).

But my filter, called with aggregate: “{{ interfaces | pc\_params }}” Only receives the host\_vars list, not the aggregated one of group\_vars interfaces list and host\_vars interfaces list, as it was supposed to do.

In resume: M filter only receives the list defined in the host\_vars, without the group\_vars contents. This is incorrect and I don’t know if I’m doing something wrong or is a bug. (using ansible 2.8 BTW)

Related information

Currently I have (excerpts):

inventory.yml

---

<div class="post-metadata">

**Author:** ![Fernando\_Garcia\_Fern](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@Fernando\_Garcia\_Fern](https://forum.ansible.com/u/Fernando_Garcia_Fern)\
**Post date:** [July 2, 2019, 7:30am UTC](https://forum.ansible.com/t/custom-filter-used-in-aggregate-doesnt-receive-the-correct-list/30583/2 "2019-07-02T07:30:11Z")

</div>

OK, I discovered it. The merge feature only works AFAIK with dictionaries. So I changed my interface list to a dictionary and the call to the filter with:

aggregate: “{{ interfaces | dict2items | if\_params }}”

so I get the merged dictionary, convert to a list and pass to my filter.

It works this way.
