From bf7c51ad8a10f32afb0a9ffd736dc7a0d183cf17 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 30 Apr 2014 13:58:18 -0500 Subject: [PATCH] Adding an ec2_elb test to re-add an instance that had been removed --- .../roles/test_ec2_elb/tasks/main.yml | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/test/integration/roles/test_ec2_elb/tasks/main.yml b/test/integration/roles/test_ec2_elb/tasks/main.yml index 30ada1955b0..97a25de5b5e 100644 --- a/test/integration/roles/test_ec2_elb/tasks/main.yml +++ b/test/integration/roles/test_ec2_elb/tasks/main.yml @@ -89,24 +89,6 @@ # ============================================================ # shutdown http first instance so it goes out of service -#- name: terminate first instance -# ec2: -# ec2_access_key: "{{ ec2_access_key }}" -# ec2_secret_key: "{{ ec2_secret_key }}" -# region: "{{ ec2_region }}" -# state: 'absent' -# instance_ids: "{{ ec2_provision_result.instance_ids[0] }}" -# register: result -# -#- name: assert the instance was terminated -# assert: -# that: -# - 'result.changed == True' -# - 'result.instance_ids[0] == ec2_provision_result.instance_ids[0]' -# -#- name: wait for the instance to die -# wait_for: port=80 host="{{ec2_provision_result.instances[0].public_ip}}" state=absent - - name: "shutdown the apache service on the first instance ({{ec2_provision_result.instances[0].public_ip}})" service: name=httpd state=stopped remote_user: "ec2-user" @@ -162,6 +144,26 @@ - 'result.changed == True' - '"{{resource_prefix}}" in result.ansible_facts.ec2_elbs' +# ============================================================ +# re-register the second instance (issue #4902) + +- name: re-register the second instance (issue #4902) + ec2_elb: + ec2_elbs: "{{ resource_prefix }}" + ec2_access_key: "{{ ec2_access_key }}" + ec2_secret_key: "{{ ec2_secret_key }}" + region: "{{ ec2_region }}" + instance_id: "{{ ec2_provision_result.instance_ids[1] }}" + state: present + wait_timeout: 300 + register: result + +- name: assert the instance was re-registered ok + assert: + that: + - 'result.changed == True' + - '"{{resource_prefix}}" in result.ansible_facts.ec2_elbs' + # ============================================================ # remove all other instances @@ -174,7 +176,7 @@ instance_id: "{{ item }}" state: absent wait_timeout: 300 - with_items: "ec2_provision_result.instance_ids[2:]" + with_items: "ec2_provision_result.instance_ids[1:]" register: result - name: assert the other instances were removed