Merge and intersect lists without using sets.

Using sets for these operations is dangerous because sets cannot contain
certain object types (such as lists) and their iteration order is
undefined.

Fixes #7596
Ensure there are no duplicates in the merged/intersected lists
Merge branch 'fix-7596' of https://github.com/kilburn/ansible into kilburn-fix-7596
Merge branch 'kilburn-fix-7596' into devel