6471e4653d
* Integration test cleanup for cloudscale modules This refactors the cleanup procedure for the integration tests of the cloudscale_server and cloudscale_volume modules to use an "always" section for cleanup. The cleanup code also deletes all resources which contain the test run prefix. This ensures that all resources are cleaned up regardless of the actual test result which is a prerequisite for running these tests in CI. * Move cloudscale_floating_ip tests from legacy to integration This also adds code to make sure that floating IPs are deleted even if a test run fails. This is unfortunately not possible for floatint IPv6 networks.
31 lines
1.1 KiB
YAML
31 lines
1.1 KiB
YAML
- name: Cloudscale floating IP tests
|
|
block:
|
|
- name: Create a server
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test01'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
register: test01
|
|
|
|
- name: Create a second server
|
|
cloudscale_server:
|
|
name: '{{ cloudscale_resource_prefix }}-test02'
|
|
flavor: '{{ cloudscale_test_flavor }}'
|
|
image: '{{ cloudscale_test_image }}'
|
|
ssh_keys: '{{ cloudscale_test_ssh_key }}'
|
|
register: test02
|
|
|
|
- include_tasks: floating_ip.yml
|
|
with_items:
|
|
- { 'ip_version': 4, 'reverse_ptr': '{{ cloudscale_resource_prefix }}-4.example.com' }
|
|
- { 'ip_version': 6, 'reverse_ptr': '{{ cloudscale_resource_prefix }}-6.example.com' }
|
|
- { 'ip_version': 6, 'prefix_length': 56 }
|
|
|
|
always:
|
|
- import_role:
|
|
name: cloudscale_common
|
|
tasks_from: cleanup_servers
|
|
- import_role:
|
|
name: cloudscale_common
|
|
tasks_from: cleanup_floating_ips
|