On Saturday, May 5, 2018 at 7:54:27 PM UTC-4, Karl Auer wrote:
>
>
> Did you actually try that?
>
> When I use that, I get the same error as before: An error occurred 
> (InvalidParameterValue) when calling the DescribeInstances operation: The 
> filter 'GroupName' is invalid
>
> ("GroupName" is the value in my variable tag_name)
>

Yes, it works. You have to construct a valid filter, and GroupName isn't a 
valid filter.
 
- hosts: localhost
  become: false
  tasks:
    - ec2_instance_facts:
        filters: "{{ { tag_name: tag_value } }}"
      vars:
        tag_name: "tag:Name"
        tag_value: "*"
    - ec2_instance_facts:
        filters: "{{ { 'tag:' ~ tag_name: tag_value } }}"
      vars:
        tag_name: Name
        tag_value: "*"


PLAY [localhost] 
***************************************************************

TASK [Gathering Facts] 
*********************************************************
ok: [localhost]

TASK [ec2_instance_facts] 
******************************************************
ok: [localhost]

TASK [ec2_instance_facts] 
******************************************************
ok: [localhost]

PLAY RECAP 
*********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0

-- 
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/3d8bda0d-0417-40df-9608-6e5a047117ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to