I've tried a LOT of things now, and have come to the conclusion that
ec2_instance_facts requires a literal filter name, at least in the case of
"tags:Name".
This makes that filter essentially useless :-(
Please, can someone tell me I'm wrong, and how me how to filter on a
tag:value pair passed in as a variable?
Thanks, K.
On Sunday, May 6, 2018 at 1:45:00 AM UTC+10, Karl Auer wrote:
>
> Trying to use ec2_instance_facts.
>
> How do I use variables instead of literals when filtering on tags?
>
> This works fine:
>
> - ec2_instance_facts:
> filters:
> "tag:Name" : "Some_name"
> register: instance_facts
>
> But if I have the tag name and tag value in variables, I cannot get it to
> compile. It complains about an invalid filter.
>
> This doesn't work (with tag_name and tag_value assigned appropriately:
>
> - ec2_instance_facts:
> filters:
> "{{ tag_group }}" : "{{ tag_value }}"
> register: instance_facts
>
> And nor does this:
>
> - ec2_instance_facts:
> filters:
> "{{ '\"tag:' + tag_name }}" : "{{ tag_value }}"
> register: instance_facts
>
> Or a dozen other variations I've tried. They all just say "the filter is
> invalid"
>
> How do I do this with variables?
>
> Regards, K.
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e53526b5-4c31-472c-a88a-96f4bfd23e2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.