I'm trying to get the id of the security group that doesn't have 'Default'
in the name.  In other words grab "sg-0a2fea74."

This is what  "sg_facts | json_query('instances[*].groups[*])" spits out:

  "groups": [
            {
                "id": "sg-828889fe",
                "name": "Default / EC2 / Linux Ansible Clients"
            },
            {
                "id": "sg-0a2fea74",
                "name": "EC2 / Shib Prd"
            },
            {
                "id": "sg-eb8b8087",
                "name": "Default / Linux Admin Access"
            }
        ],

My with_items filter below is not working but illustrates what I'm trying
to do.  Anyone know how I can get this done?  -- Thanks

- name: Gather facts
  ec2_remote_facts:
    region: us-east-1
    filters:
      "tag:Resource_group_id": "{{ resource_group_id_tag }}"
  register: sg_facts
- debug: var={{ item }}
  with_items: "{{ sg_facts | json_query('instances[*].groups[*].[?name !~
'Default'].id') }}"

Ansible 2.3 isn't in the yum repo yet or I could use ec2_group_facts, which
would probably make this simpler...


Kenton Brede

-- 
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/CA%2BnSE39ddDquw8QkhboA7sWvrniWSMN4uXuDWL8TCpPinbyO1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to