Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #1468/1cd7cebb backport][stable-4] tests/autoscaling_{group,lifecycle_hook}: use setup_ec2_facts #1499

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/integration/targets/ec2_asg/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
security_token: "{{ security_token | default(omit) }}"
region: "{{ aws_region }}"
block:
- include_role:
name: 'setup_ec2_facts'
- include_role:
name: 'ec2_asg'
tasks_from: env_setup.yml
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/targets/ec2_asg/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dependencies: []
dependencies:
- setup_ec2_facts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
# defaults file for ec2_asg
# Amazon Linux 2 AMI 2019.06.12 (HVM), GP2 Volume Type
ec2_ami_name: 'amzn2-ami-hvm-2.0.20190612-x86_64-gp2'
load_balancer_name: "{{ tiny_prefix }}-lb"
ec2_asg_setup_run_once: true
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
ec2_lc:
name: "{{ item }}"
assign_public_ip: true
image_id: "{{ ec2_ami_image }}"
image_id: "{{ ec2_ami_id }}"
user_data: |
#cloud-config
package_upgrade: true
Expand Down Expand Up @@ -431,7 +431,7 @@
- name: create launch template for autoscaling group to test its mixed instances policy
ec2_launch_template:
template_name: "{{ resource_prefix }}-lt"
image_id: "{{ ec2_ami_image }}"
image_id: "{{ ec2_ami_id }}"
instance_type: t3.micro
credit_specification:
cpu_credits: standard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
run_once: '{{ ec2_asg_setup_run_once }}'
block:

# ============================================================

- name: Find AMI to use
ec2_ami_info:
owners: 'amazon'
filters:
name: '{{ ec2_ami_name }}'
register: ec2_amis
- set_fact:
ec2_ami_image: '{{ ec2_amis.images[0].image_id }}'

# Set up the testing dependencies: VPC, subnet, security group, and two launch configurations
- name: Create VPC for use in testing
ec2_vpc_net:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: create a launch configuration
ec2_lc:
name: "{{ resource_prefix }}-lc-detach-test"
image_id: "{{ ec2_ami_image }}"
image_id: "{{ ec2_ami_id }}"
region: "{{ aws_region }}"
instance_type: t2.micro
assign_public_ip: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- name: create a launch configuration
ec2_lc:
name: "{{ resource_prefix }}-lc-tag-test"
image_id: "{{ ec2_ami_image }}"
image_id: "{{ ec2_ami_id }}"
region: "{{ aws_region }}"
instance_type: t2.micro
assign_public_ip: yes
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/targets/ec2_asg_lifecycle_hook/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# running an 'include' that was run_once
setup_run_once: yes
block:
- include_role:
name: 'setup_ec2_facts'
- include_role:
name: 'ec2_asg_lifecycle_hook'
tasks_from: env_setup.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dependencies: []
dependencies:
- setup_ec2_facts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# defaults file for ec2_asg_lifecycle_hook
# Amazon Linux 2 AMI 2019.06.12 (HVM), GP2 Volume Type
ec2_ami_name: 'amzn2-ami-hvm-2.0.20190612-x86_64-gp2'
load_balancer_name: "{{ tiny_prefix }}-lb"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- name: create a launch configuration
ec2_lc:
name: "{{ resource_prefix }}-lc"
image_id: "{{ ec2_ami_image }}"
image_id: "{{ ec2_ami_id }}"
region: "{{ aws_region }}"
instance_type: t2.micro
assign_public_ip: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

# ============================================================

- name: Find AMI to use
ec2_ami_info:
owners: 'amazon'
filters:
name: '{{ ec2_ami_name }}'
register: ec2_amis
- set_fact:
ec2_ami_image: '{{ ec2_amis.images[0].image_id }}'

# Set up the testing dependencies: VPC, subnet, security group, and two launch configurations
- name: Create VPC for use in testing
ec2_vpc_net:
Expand Down