Skip to content

Commit

Permalink
Remove collection reference inside the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GomathiselviS committed Oct 17, 2024
1 parent c3be26b commit 9a92d01
Show file tree
Hide file tree
Showing 3 changed files with 581 additions and 579 deletions.
32 changes: 16 additions & 16 deletions tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: remove any instances in the test VPC
ec2_instance:
filters:
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
state: absent
register: removed
until: removed is not failed
Expand All @@ -11,23 +11,23 @@
- name: Get ENIs
ec2_eni_info:
filters:
vpc-id: "{{ testing_vpc.vpc.id }}"
vpc-id: '{{ testing_vpc.vpc.id }}'
register: enis

- name: delete all ENIs
ec2_eni:
eni_id: "{{ item.id }}"
eni_id: '{{ item.id }}'
state: absent
until: removed is not failed
with_items: "{{ enis.network_interfaces }}"
with_items: '{{ enis.network_interfaces }}'
ignore_errors: yes
retries: 10

- name: remove the security group
ec2_security_group:
name: "{{ resource_prefix }}-sg"
name: '{{ resource_prefix }}-sg'
description: a security group for ansible tests
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
state: absent
register: removed
until: removed is not failed
Expand All @@ -37,23 +37,23 @@
- name: remove routing rules
ec2_vpc_route_table:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
tags:
created: "{{ resource_prefix }}-route"
created: '{{ resource_prefix }}-route'
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ igw.gateway_id }}"
- dest: 0.0.0.0/0
gateway_id: '{{ igw.gateway_id }}'
subnets:
- "{{ testing_subnet_a.subnet.id }}"
- "{{ testing_subnet_b.subnet.id }}"
- '{{ testing_subnet_a.subnet.id }}'
- '{{ testing_subnet_b.subnet.id }}'
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10

- name: remove internet gateway
ec2_vpc_igw:
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
state: absent
register: removed
until: removed is not failed
Expand All @@ -63,7 +63,7 @@
- name: remove subnet A
ec2_vpc_subnet:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
cidr: 10.22.32.0/24
register: removed
until: removed is not failed
Expand All @@ -73,7 +73,7 @@
- name: remove subnet B
ec2_vpc_subnet:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
cidr: 10.22.33.0/24
register: removed
until: removed is not failed
Expand All @@ -82,7 +82,7 @@

- name: remove the VPC
ec2_vpc_net:
name: "{{ resource_prefix }}-vpc"
name: '{{ resource_prefix }}-vpc'
cidr_block: 10.22.32.0/23
state: absent
tags:
Expand Down
48 changes: 24 additions & 24 deletions tests/integration/targets/ec2_placement_group/tasks/env_setup.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Create VPC for use in testing
ec2_vpc_net:
name: "{{ resource_prefix }}-vpc"
name: '{{ resource_prefix }}-vpc'
cidr_block: 10.22.32.0/23
tags:
Name: Ansible ec2_lc Testing VPC
Expand All @@ -9,7 +9,7 @@

- name: Create internet gateway for use in testing
ec2_vpc_igw:
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
state: present
tags:
Name: Ansible ec2_lc Testing gateway
Expand All @@ -18,47 +18,47 @@
- name: Create default subnet in zone A
ec2_vpc_subnet:
state: present
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
cidr: 10.22.32.0/24
az: "{{ aws_region }}a"
az: '{{ aws_region }}a'
resource_tags:
Name: "{{ resource_prefix }}-subnet-a"
Name: '{{ resource_prefix }}-subnet-a'
register: testing_subnet_a

- name: Create secondary subnet in zone B
ec2_vpc_subnet:
state: present
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
cidr: 10.22.33.0/24
az: "{{ aws_region }}b"
az: '{{ aws_region }}b'
resource_tags:
Name: "{{ resource_prefix }}-subnet-b"
Name: '{{ resource_prefix }}-subnet-b'
register: testing_subnet_b

- name: create routing rules
ec2_vpc_route_table:
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
tags:
created: "{{ resource_prefix }}-route"
created: '{{ resource_prefix }}-route'
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ igw.gateway_id }}"
- dest: 0.0.0.0/0
gateway_id: '{{ igw.gateway_id }}'
subnets:
- "{{ testing_subnet_a.subnet.id }}"
- "{{ testing_subnet_b.subnet.id }}"
- '{{ testing_subnet_a.subnet.id }}'
- '{{ testing_subnet_b.subnet.id }}'

- name: create a security group with the vpc
ec2_security_group:
name: "{{ resource_prefix }}-sg"
name: '{{ resource_prefix }}-sg'
description: a security group for ansible tests
vpc_id: "{{ testing_vpc.vpc.id }}"
vpc_id: '{{ testing_vpc.vpc.id }}'
rules:
- proto: tcp
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 22
to_port: 22
cidr_ip: 0.0.0.0/0
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: 0.0.0.0/0
register: sg
Loading

0 comments on commit 9a92d01

Please sign in to comment.