1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/cloudscale_floating_ip/tasks/main.yml
Gaudenz Steinlin a65a137cdd Fix failure of cloudscale_floating_ip without server (#53702)
The cloudscale_floating_ip module failed if no server was assigned to
the floating IP. This also adds a test to avoid a regression.

The only way to have a floating IP without a server assigned is to
delete the server where the floating IP is currently assigned. Under
normal circumstances it's not possible to have an unassigned floating
IP.
2019-03-15 09:50:09 +00:00

33 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 }
- import_tasks: unassigned.yml
always:
- import_role:
name: cloudscale_common
tasks_from: cleanup_servers
- import_role:
name: cloudscale_common
tasks_from: cleanup_floating_ips