Working with variables

22 views
Skip to first unread message

Alexander Popov

unread,
Jul 12, 2015, 2:01:48 PM7/12/15
to ansible...@googlegroups.com
I not  found answers  in documentation, sorry if its lame, it's my first day with ansible

i'm creating vpc:

  ec2_vpc:

    state: present

    cidr_block: 172.30.0.0/16

    subnets:

      - cidr: 172.30.3.0/24

        az: ..

        resource_tags: {  "tag" : "tag1" }

      - cidr: 172.30.1.0/24

        az: "{{ region }}a"

        resource_tags: { ""tag" : "tag1" }

  register: vpc


its assign value to vpc with array of subnets:

  "subnets": [

                {

                    "id": "subnet-zzzzzzz",

                    "resource_tags": {...

                    }

                    .. .

                },

                {

                    "id": "subnet-xxxxxxx",

                    "resource_tags": {...

                    }

                    ...

                }

                },



for some other calls I need  this subnets in different forms



for example ec2_elb_lb requires list of ids:


subnets:
      - subnet-xxxxxxxx
      - subnet-zzzzzzzz
 How can i convert  vpc.subnets array  to array of ids? What if i need filter them by tag ? 
Does it any analog for map of filter operations in ansible?








Reply all
Reply to author
Forward
0 new messages