Hi,
So here's the scenario - I'm given a data structure that when converted to yaml looks like this (names & numbers invented).
host_routes:
route-oob:
device: bond.123
routes:
10.118.0.0/16: '10.118.255.254'
route-int:
device: bond.456
routes:
172.168.0.0/23: '172.168.1.254'
I can use that with a template to create the network-script route files needed, that's easy enough. But in real life there can be up to several OOB routes that this host will need depending on which datacentre / hall / security zone it resides in. e.g.
standard_routes:
route-oob:
device: bond.123
routes:
10.198.0.0/24: '10.118.255.254'
I'd like to add these additional routes to the appropriate group_var file and then merge them together when creating the route files. I can't get this to work though. I've tried all the following:
with_dict: host_routes|union(standard_routes)
with_dict: union(host_routes, standard_routes)
with_dict: host_routes + standard_routes
and get the same error every time ..
fatal: [localhost] => with_dict expects a dict
Is there another filter or some other way of doing this? I don't want to change the default hash_behaviour to merge just for this one use case as that has much wider implications.
Thanks, John