Re-enable the ec2_eip test

This commit is contained in:
James Cammarata 2014-08-05 09:20:23 -05:00
parent 7fd2d1c3df
commit 5c2c10987e
2 changed files with 39 additions and 28 deletions

View file

@ -8,7 +8,7 @@
#- { role: test_ec2_tag, tags: test_ec2_tag } #- { role: test_ec2_tag, tags: test_ec2_tag }
#- { role: test_ec2_facts, tags: test_ec2_facts } #- { role: test_ec2_facts, tags: test_ec2_facts }
- { role: test_ec2_elb_lb, tags: test_ec2_elb_lb } - { role: test_ec2_elb_lb, tags: test_ec2_elb_lb }
#- { role: test_ec2_eip, tags: test_ec2_eip } - { role: test_ec2_eip, tags: test_ec2_eip }
#- { role: test_ec2_ami, tags: test_ec2_ami } #- { role: test_ec2_ami, tags: test_ec2_ami }
#- { role: test_ec2, tags: test_ec2 } #- { role: test_ec2, tags: test_ec2 }
- { role: test_ec2_asg, tags: test_ec2_asg } - { role: test_ec2_asg, tags: test_ec2_asg }

View file

@ -32,17 +32,28 @@
# test credential parameters # test credential parameters
# ============================================================ # ============================================================
# create a keypair using the ssh key
- name: create the keypair for ec2
ec2_key:
name: "{{ resource_prefix }}"
region: "{{ ec2_region }}"
ec2_access_key: "{{ ec2_access_key }}"
ec2_secret_key: "{{ ec2_secret_key }}"
key_material: "{{ key_material }}"
wait: yes
state: present
# ============================================================
# create test instance # create test instance
- name: create test instance - name: create test instance
local_action: local_action:
module: ec2 module: ec2
key_name: "{{ eip_ec2_keyname }}" key_name: "{{ resource_prefix }}"
region: "{{ ec2_region }}" region: "{{ ec2_region }}"
instance_type: t1.micro instance_type: t1.micro
image: "{{ eip_ec2_image }}" image: ami-fb8e9292
wait: yes wait: yes
instance_tags: instance_tags:
Name: "{{ tag_prefix }}" Name: "{{ tag_prefix }}"
@ -243,32 +254,32 @@
# ============================================================ # ============================================================
# re-use existing VPC EIP with instance # re-use existing VPC EIP with instance
# DISABLED BY JCAMMARATA
- name: re-use existing EIP with instance #- name: re-use existing VPC EIP with instance
ec2_eip: # ec2_eip:
in_vpc=yes # in_vpc=yes
reuse_existing_ip_allowed=yes # reuse_existing_ip_allowed=yes
instance_id={{ instance_id }} # instance_id={{ instance_id }}
ec2_access_key={{ ec2_access_key }} # ec2_access_key={{ ec2_access_key }}
ec2_secret_key={{ ec2_secret_key }} # ec2_secret_key={{ ec2_secret_key }}
region={{ ec2_region }} # region={{ ec2_region }}
register: result # register: result
#
- name: assert new EIP was assigned #- name: assert new VPC EIP was assigned
assert: # assert:
that: # that:
- '"failed" not in result' # - '"failed" not in result'
- '"public_ip" in result' # - '"public_ip" in result'
#
#
#- name: disassociate VPC EIP associated with instance
# ec2_eip: state=absent public_ip={{ eip }} region={{ ec2_region }}
# ec2_access_key={{ ec2_access_key }}
# ec2_secret_key={{ ec2_secret_key }}
# instance_id={{ instance_id }}
- name: disassociate EIP associated with instance - name: deactivate VPC EIP
ec2_eip: state=absent public_ip={{ eip }} region={{ ec2_region }}
ec2_access_key={{ ec2_access_key }}
ec2_secret_key={{ ec2_secret_key }}
instance_id={{ instance_id }}
- name: deactivate EIP
ec2_eip: state=absent public_ip={{ eip }} region={{ ec2_region }} ec2_eip: state=absent public_ip={{ eip }} region={{ ec2_region }}
ec2_access_key={{ ec2_access_key }} ec2_access_key={{ ec2_access_key }}
ec2_secret_key={{ ec2_secret_key }} ec2_secret_key={{ ec2_secret_key }}