Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar242 committed Oct 22, 2024
1 parent 5c21687 commit 9c54ea3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions plugins/modules/elb_classic_lb_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
---
module: elb_classic_lb_info
version_added: 1.0.0
version_added_collection: community.aws
short_description: Gather information about EC2 Classic Elastic Load Balancers in AWS
description:
- Gather information about EC2 Classic Elastic Load Balancers in AWS.
Expand Down
38 changes: 19 additions & 19 deletions tests/integration/targets/elb_classic_lb_info/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# create test elb with listeners, certificate, and health check

- name: Create ELB
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: present
zones:
Expand All @@ -50,7 +50,7 @@
healthy_threshold: 10
register: create

- assert:
- ansible.builtin.assert:
that:
- create is changed
# We rely on these for the info test, make sure they're what we expect
Expand All @@ -69,7 +69,7 @@
names: '{{ elb_name }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- info.elbs|length == 1
- elb.availability_zones|length == 2
Expand Down Expand Up @@ -113,7 +113,7 @@
# Change AZ's

- name: Change AZ's
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: present
zones:
Expand All @@ -133,7 +133,7 @@
healthy_threshold: 10
register: update_az

- assert:
- ansible.builtin.assert:
that:
- update_az is changed
- update_az.elb.zones[0] == aws_region ~ 'c'
Expand All @@ -143,7 +143,7 @@
names: '{{ elb_name }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- elb.availability_zones|length == 1
- aws_region ~ 'c' in elb.availability_zones[0]
Expand All @@ -155,7 +155,7 @@
# Update AZ's

- name: Update AZ's
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: present
zones:
Expand All @@ -169,7 +169,7 @@
purge_zones: yes
register: update_az

- assert:
- ansible.builtin.assert:
that:
- update_az is changed
- aws_region ~ 'a' in update_az.elb.zones
Expand All @@ -181,7 +181,7 @@
names: '{{ elb_name }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- elb.availability_zones|length == 3
- aws_region ~ 'a' in elb.availability_zones
Expand All @@ -195,7 +195,7 @@
# Purge Listeners

- name: Purge Listeners
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: present
zones:
Expand All @@ -209,7 +209,7 @@
purge_listeners: yes
register: purge_listeners

- assert:
- ansible.builtin.assert:
that:
- purge_listeners is changed
- '[80, 81, "HTTP", "HTTP"] in purge_listeners.elb.listeners'
Expand All @@ -220,7 +220,7 @@
names: '{{ elb_name }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- elb.listener_descriptions|length == 1
- '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port":
Expand All @@ -234,7 +234,7 @@
# add Listeners

- name: Add Listeners
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: present
zones:
Expand All @@ -248,7 +248,7 @@
purge_listeners: no
register: update_listeners

- assert:
- ansible.builtin.assert:
that:
- update_listeners is changed
- '[80, 81, "HTTP", "HTTP"] in update_listeners.elb.listeners'
Expand All @@ -260,7 +260,7 @@
names: '{{ elb_name }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- elb.listener_descriptions|length == 2
- '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port":
Expand All @@ -280,7 +280,7 @@
names: invalid-elb
register: info

- assert:
- ansible.builtin.assert:
that:
- info.elbs|length==0

Expand All @@ -290,7 +290,7 @@
names: ['{{ elb_name }}', invalid-elb]
register: info

- assert:
- ansible.builtin.assert:
that:
- info.elbs|length==1
- info.elbs[0].load_balancer_name == elb_name
Expand All @@ -302,15 +302,15 @@
names: '{{ omit }}'
register: info

- assert:
- ansible.builtin.assert:
that:
- info.elbs|length>0

always:

# ============================================================
- name: remove the test load balancer completely
elb_classic_lb:
amazon.aws.elb_classic_lb:
name: '{{ elb_name }}'
state: absent
register: result
Expand Down

0 comments on commit 9c54ea3

Please sign in to comment.