Open
Description
Hi,
First of all, great collection! Works like a charm.
I'm having a use case in which I need to filter the instances by tags.
I quickly hacked something together like this:
def instance_tags_in_filter_tags(self, filter_tags, instance):
instance_tags = instance.get('tags', [])
for tag in filter_tags:
if not tag.items() <= instance_tags.items():
return False
return True
def parse(self, inventory, loader, path, cache=False):
...
for instance in instances:
filter_tags = self.get_option('filter_by_tags')
if filter_tags and not self.instance_tags_in_filter_tags(filter_tags, instance):
continue
Example in the cloudstack-instances.yml
filter_by_tags:
- foo: bar
- bar: foo
Maybe not ideal yet, just to prototype the idea.
Before I open a PR, is that something you would consider adding?
Cheers
Markus
Metadata
Metadata
Assignees
Labels
No labels