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/ee9c07c4-c1f5-4c05-8817-fb2751a5ab4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to