vpc_and_subnet_id.yml 606 B

1234567891011121314151617181920212223242526
  1. ---
  2. - name: query vpc
  3. ec2_vpc_net_facts:
  4. region: "{{ openshift_aws_region }}"
  5. filters:
  6. 'tag:Name': "{{ openshift_aws_vpc_name }}"
  7. register: vpcout
  8. - name: debug vpcout
  9. debug:
  10. var: vpcout
  11. verbosity: 1
  12. - name: fetch the subnet ids
  13. ec2_vpc_subnet_facts:
  14. region: "{{ openshift_aws_region }}"
  15. filters:
  16. availability-zone: "{{ item }}"
  17. vpc-id: "{{ vpcout.vpcs[0].id }}"
  18. with_items: "{{ openshift_aws_vpc.subnets[openshift_aws_region] | map(attribute='az') | list }}"
  19. register: subnetout
  20. - name: debug subnetout
  21. debug:
  22. var: subnetout
  23. verbosity: 1