Merge pull request #11319 from sivel/asg-tests

Add tests for rax_scaling_group
This commit is contained in:
Brian Coca 2015-06-18 15:43:43 -04:00
commit bbcd172eb3
6 changed files with 911 additions and 1 deletions

View file

@ -138,6 +138,26 @@ def delete_rax_cdb(args):
args.assumeyes)
def _force_delete_rax_scaling_group(manager):
def wrapped(uri):
manager.api.method_delete('%s?force=true' % uri)
return wrapped
def delete_rax_scaling_group(args):
"""Function for deleting Autoscale Groups"""
print ("--- Cleaning Autoscale Groups matching '%s'" % args.match_re)
for region in pyrax.identity.services.autoscale.regions:
asg = pyrax.connect_to_autoscale(region=region)
for group in rax_list_iterator(asg):
if re.search(args.match_re, group.name):
group.manager._delete = \
_force_delete_rax_scaling_group(group.manager)
prompt_and_delete(group,
'Delete matching %s? [y/n]: ' % group,
args.assumeyes)
def main():
if not HAS_PYRAX:
raise SystemExit('The pyrax python module is required for this script')

View file

@ -40,3 +40,6 @@
- role: test_rax_cdb_database
tags: test_rax_cdb_database
- role: test_rax_scaling_group
tags: test_rax_scaling_group

View file

@ -7,4 +7,10 @@ rackspace_flavor: "performance1-1"
rackspace_keypair_pub: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDymofzvt86DUA6XSSxc7eDHwUNvcOSmUWjB76jFvhYc6PbS5QmTzBtCka1ORdaW0Z2i3EjfFvzA8WvuY3qP/FpIVDL25ZqZHgxSfGN5pbJ2tAeXK165kNPXBuuISrMhmdLFbRZNn6PwKHEmtrtfEQ3w6ay9+MhqlEr0OX2r6bCXLj+f50QnQXamU6Fm4IpkTsb60osvHNi569Dd8cADEv92oLZpNMa8/MPGnlipjauhzNtEDTUeZwtrAQUXe6CzJ0QmIlyKDglDZLuAKU/VRumo1FRsn4AwJnVsbP2CHBPkbNoYt6LhQiQqXypEIWGmIln0dlO6gZTr3dYC4BVGREl"
resource_prefix: ansible-testing
resource_prefix: "ansible-testing"
rackspace_alt_image_id: "e5575e1a-a519-4e21-9a6b-41207833bd39"
rackspace_alt_image_name: "CentOS 6 (PVHVM)"
rackspace_alt_image_human_id: "centos-6-pvhvm"
rackspace_alt_flavor: "general1-1"

View file

@ -0,0 +1 @@
this is a test file

View file

@ -0,0 +1,3 @@
dependencies:
- prepare_tests
- prepare_rax_tests

View file

@ -0,0 +1,877 @@
# ============================================================
- name: Test rax_scaling_group with no args
rax_scaling_group:
ignore_errors: true
register: rax_scaling_group
- name: Validate results of rax_scaling_group with no args
assert:
that:
- rax_scaling_group|failed
- "rax_scaling_group.msg == 'missing required arguments: image,min_entities,flavor,max_entities,name,server_name'"
# ============================================================
# ============================================================
- name: Test rax_scaling_group with image,min_entities,flavor,max_entities,name,server_name
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
ignore_errors: true
register: rax_scaling_group
- name: Validate results of rax_scaling_group with image,min_entities,flavor,max_entities,name,server_name
assert:
that:
- rax_scaling_group|failed
- rax_scaling_group.msg == 'No credentials supplied!'
# ============================================================
# ============================================================
- name: Test rax_scaling_group with creds and required args
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
ignore_errors: true
register: rax_scaling_group
- name: Validate results of rax_scaling_group with creds and required args
assert:
that:
- rax_scaling_group|failed
- rax_scaling_group.msg.startswith('None is not a valid region')
# ============================================================
# ============================================================
- name: Test rax_scaling_group with creds, region and required args
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate results of rax_scaling_group with creds, region and required args
assert:
that:
- rax_scaling_group|success
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-1"
- rax_scaling_group.autoscale_group.min_entities == 1
- rax_scaling_group.autoscale_group.max_entities == 1
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.flavorRef == "{{ rackspace_flavor }}"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.imageRef == "{{ rackspace_image_id }}"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.name == "{{ resource_prefix }}-1"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.personality == []
- rax_scaling_group.autoscale_group.launchConfiguration.args.loadBalancers == []
- rax_scaling_group.autoscale_group.metadata == {}
- name: Test rax_scaling_group idempotency 1
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate idempotency 1
assert:
that:
- not rax_scaling_group|changed
- name: Remove servers 1
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate remove servers 1
assert:
that:
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.min_entities == 0
- rax_scaling_group.autoscale_group.max_entities == 0
- rax_scaling_group.autoscale_group.state.desiredCapacity == 0
- name: Test delete integration 1
rax_scaling_group:
name: "{{ resource_prefix }}-1"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
state: absent
register: rax_scaling_group
- name: Validate delete integration 1
assert:
that:
- rax_scaling_group|changed
# ============================================================
# ============================================================
- name: Test rax_scaling_group server_name change 1
rax_scaling_group:
name: "{{ resource_prefix }}-2"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-2"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate results of rax_scaling_group server_name change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-2"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.name == "{{ resource_prefix }}-2"
- name: Test rax_scaling_group server_name change 2
rax_scaling_group:
name: "{{ resource_prefix }}-2"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-2a"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate results of rax_scaling_group server_name change 2
assert:
that:
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-2"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.name == "{{ resource_prefix }}-2a"
- name: Remove servers 2
rax_scaling_group:
name: "{{ resource_prefix }}-2"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-2a"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate remove servers 2
assert:
that:
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.min_entities == 0
- rax_scaling_group.autoscale_group.max_entities == 0
- rax_scaling_group.autoscale_group.state.desiredCapacity == 0
- name: Test delete integration 2
rax_scaling_group:
name: "{{ resource_prefix }}-2"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-2a"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
state: absent
register: rax_scaling_group
- name: Validate delete integration 2
assert:
that:
- rax_scaling_group|changed
# ============================================================
# ============================================================
- name: Test rax_scaling_group with invalid load balancers
rax_scaling_group:
name: "{{ resource_prefix }}-3"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-3"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
loadbalancers:
- id: "1234567890-0987654321"
port: 80
register: rax_scaling_group
ignore_errors: true
- name: Validate results of rax_scaling_group with load balancers
assert:
that:
- rax_scaling_group|failed
- rax_scaling_group.msg.startswith('Load balancer ID is not an integer')
# ============================================================
# ============================================================
- name: Build a CLB to test rax_scaling_group with
rax_clb:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ resource_prefix }}-clb"
wait: true
register: rax_clb
- name: Validate rax_clb creation
assert:
that:
- rax_clb|success
- name: Set variable for CLB ID
set_fact:
rax_clb_id: "{{ rax_clb.balancer.id }}"
# ============================================================
# ============================================================
- name: Test rax_scaling_group with load balancers
rax_scaling_group:
name: "{{ resource_prefix }}-3"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-3"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
loadbalancers:
- id: "{{ rax_clb_id }}"
port: 80
register: rax_scaling_group
- name: Validate results of rax_scaling_group with load balancers
assert:
that:
- rax_scaling_group|success
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-3"
- rax_scaling_group.autoscale_group.launchConfiguration.args.loadBalancers[0].loadBalancerId == rax_clb_id|int
- name: Remove servers 3
rax_scaling_group:
name: "{{ resource_prefix }}-3"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-3"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Test delete integration 3
rax_scaling_group:
name: "{{ resource_prefix }}-3"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-3"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
state: absent
register: rax_scaling_group
# ============================================================
# ============================================================
- name: Test rax_scaling_group files change 1
rax_scaling_group:
name: "{{ resource_prefix }}-4"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
files:
/tmp/test.txt: "{{ role_path }}/files/test.txt"
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-4"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate results of rax_scaling_group files change 1
assert:
that:
- rax_scaling_group|success
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-4"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.personality|length == 1
- name: Test rax_scaling_group files change 2
rax_scaling_group:
name: "{{ resource_prefix }}-4"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-4"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate results of rax_scaling_group files change 2
assert:
that:
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-4"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.personality is not defined
- name: Remove servers 4
rax_scaling_group:
name: "{{ resource_prefix }}-4"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-4"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Test delete integration 4
rax_scaling_group:
name: "{{ resource_prefix }}-4"
image: "{{ rackspace_image_id }}"
min_entities: 0
max_entities: 0
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-4"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
state: absent
register: rax_scaling_group
# ============================================================
# ============================================================
- name: Build scaling group to test argument changes
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
register: rax_scaling_group
- name: Validate default create
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.name == "{{ resource_prefix }}-5"
- rax_scaling_group.autoscale_group.min_entities == 1
- rax_scaling_group.autoscale_group.max_entities == 1
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.flavorRef == "{{ rackspace_flavor }}"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.imageRef == "{{ rackspace_image_id }}"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.name == "{{ resource_prefix }}-5"
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.personality == []
- rax_scaling_group.autoscale_group.launchConfiguration.args.loadBalancers == []
- rax_scaling_group.autoscale_group.metadata == {}
# ============================================================
# ============================================================
- name: Change cooldown
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 1
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate cooldown change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.cooldown == 500
# ============================================================
# ============================================================
- name: Change max_entities
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_image_id }}"
min_entities: 1
max_entities: 2
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate max_entities change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.max_entities == 2
# ============================================================
# ============================================================
- name: Change min_entities
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate min_entities change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.min_entities == 2
# ============================================================
# ============================================================
- name: Change server_name
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate server_name change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.name == "{{ resource_prefix }}-5-1"
# ============================================================
# ============================================================
- name: Change image
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate image change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.imageRef == "{{ rackspace_alt_image_id }}"
# ============================================================
# ============================================================
- name: Change flavor
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
register: rax_scaling_group
- name: Validate flavor change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.flavorRef == "{{ rackspace_alt_flavor }}"
# ============================================================
# ============================================================
- name: Change disk_config
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: auto
register: rax_scaling_group
- name: Validate flavor change
assert:
that:
- rax_scaling_group|success
- not rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server['OS-DCF:diskConfig'] == 'AUTO'
- name: Change disk_config 2
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
register: rax_scaling_group
- name: Validate flavor change 2
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server['OS-DCF:diskConfig'] == 'MANUAL'
# ============================================================
# ============================================================
- name: Change networks
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
networks:
- public
register: rax_scaling_group
- name: Validate networks change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.networks.0.uuid == "00000000-0000-0000-0000-000000000000"
# ============================================================
# ============================================================
- name: Change load balancers
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
networks:
- public
- private
loadbalancers:
- id: "{{ rax_clb_id }}"
port: 80
register: rax_scaling_group
- name: Validate networks change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.loadBalancers.0.loadBalancerId == rax_clb_id|int
# ============================================================
# ============================================================
- name: Create keypair to test with
rax_keypair:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ resource_prefix }}-keypair"
public_key: "{{ rackspace_keypair_pub }}"
register: rax_keypair
- name: Validate rax_keypair creation
assert:
that:
- rax_keypair|success
- rax_keypair|changed
- rax_keypair.keypair.name == "{{ resource_prefix }}-keypair"
- rax_keypair.keypair.public_key == "{{ rackspace_keypair_pub }}"
# ============================================================
# ============================================================
- name: Change key_name
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
networks:
- public
- private
loadbalancers:
- id: "{{ rax_clb_id }}"
port: 80
key_name: "{{ resource_prefix }}-keypair"
register: rax_scaling_group
- name: Validate key_name change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.key_name == "{{ resource_prefix }}-keypair"
# ============================================================
# ============================================================
- name: Change config_drive
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
networks:
- public
- private
loadbalancers:
- id: "{{ rax_clb_id }}"
port: 80
key_name: "{{ resource_prefix }}-keypair"
config_drive: true
register: rax_scaling_group
- name: Validate config_drive change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.config_drive
# ============================================================
# ============================================================
- name: Change config_drive
rax_scaling_group:
name: "{{ resource_prefix }}-5"
image: "{{ rackspace_alt_image_id }}"
min_entities: 2
max_entities: 2
flavor: "{{ rackspace_alt_flavor }}"
server_name: "{{ resource_prefix }}-5-1"
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
cooldown: 500
disk_config: manual
networks:
- public
- private
loadbalancers:
- id: "{{ rax_clb_id }}"
port: 80
key_name: "{{ resource_prefix }}-keypair"
config_drive: true
user_data: "foo"
register: rax_scaling_group
- name: Validate config_drive change
assert:
that:
- rax_scaling_group|success
- rax_scaling_group|changed
- rax_scaling_group.autoscale_group.launchConfiguration.args.server.user_data == '{{ "foo"|b64encode }}'
# ============================================================
# ============================================================
- name: Delete keypair
rax_keypair:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ resource_prefix }}-keypair"
public_key: "{{ rackspace_keypair_pub }}"
state: absent
register: rax_keypair
- name: Validate rax_keypair creation
assert:
that:
- rax_keypair|success
- rax_keypair|changed
# ============================================================
# ============================================================
- name: Delete CLB
rax_clb:
username: "{{ rackspace_username }}"
api_key: "{{ rackspace_api_key }}"
region: "{{ rackspace_region }}"
name: "{{ rax_clb.balancer.name }}"
state: absent
wait: true
register: rax_clb
- name: "Validate delete integration 3"
assert:
that:
- rax_clb|changed
- rax_clb.balancer.id == rax_clb_id|int
# ============================================================