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/tests/integration/targets/cloudscale_floating_ip/tasks/floating_ip.yml
Ansible Core Team aebc1b03fd Initial commit
2020-03-09 09:11:07 +00:00

129 lines
3.9 KiB
YAML

- name: Request regional floating IP
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip_version: '{{ item.ip_version }}'
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
prefix_length: '{{ item.prefix_length | default(omit) }}'
region: '{{ cloudscale_test_region }}'
register: floating_ip
- name: Verify request floating IP
assert:
that:
- floating_ip is successful
- floating_ip is changed
- floating_ip.region.slug == '{{ cloudscale_test_region }}'
- (item.ip_version == 4 and floating_ip.ip | ipv4) or (item.ip_version == 6 and floating_ip.ip | ipv6)
- floating_ip.server == test01.uuid
- name: Check floating IP idempotence
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip: '{{ floating_ip.ip }}'
region: '{{ cloudscale_test_region }}'
register: floating_ip_idempotence
- name: Verify floating IP idempotence
assert:
that:
- floating_ip_idempotence is successful
- floating_ip_idempotence is not changed
- floating_ip_idempotence.server == test01.uuid
- floating_ip.region.slug == '{{ cloudscale_test_region }}'
- name: Request global floating IP
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip_version: '{{ item.ip_version }}'
reverse_ptr: '{{ item.reverse_ptr | default(omit) }}'
prefix_length: '{{ item.prefix_length | default(omit) }}'
type: 'global'
register: global_floating_ip
- name: Verify global floating IP
assert:
that:
- global_floating_ip is successful
- global_floating_ip is changed
- global_floating_ip.region == None
- global_floating_ip.type == 'global'
- (item.ip_version == 4 and global_floating_ip.ip | ipv4) or (item.ip_version == 6 and global_floating_ip.ip | ipv6)
- global_floating_ip.server == test01.uuid
- name: Release global floating IP
cloudscale_floating_ip:
ip: '{{ global_floating_ip.ip }}'
state: 'absent'
register: global_floating_ip
- name: Verify release of global floating IP
assert:
that:
- global_floating_ip is successful
- global_floating_ip is changed
- global_floating_ip.state == 'absent'
- name: Check network parameter alias
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
network: '{{ floating_ip.ip }}'
register: floating_ip_network
- name: Verify network parameter alias
assert:
that:
- floating_ip_network is successful
- name: Move floating IP to second server
cloudscale_floating_ip:
server: '{{ test02.uuid }}'
ip: '{{ floating_ip.ip }}'
register: move_ip
- name: Verify move floating IPv4 to second server
assert:
that:
- move_ip is successful
- move_ip is changed
- move_ip.server == test02.uuid
- name: Fail if server is missing on update
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
register: update_failed
ignore_errors: True
- name: Verify fail if server is missing on update
assert:
that:
- update_failed is failed
- "'Missing required parameter' in update_failed.msg"
- name: Release floating IP
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
state: 'absent'
register: release_ip
- name: Verify release floating IPs
assert:
that:
- release_ip is successful
- release_ip is changed
- release_ip.state == 'absent'
- name: Release floating IP idempotence
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
state: 'absent'
register: release_ip
- name: Verify release floating IPs idempotence
assert:
that:
- release_ip is successful
- release_ip is not changed
- release_ip.state == 'absent'
- name: Fail if server is missing on request
cloudscale_floating_ip:
ip_version: 6
register: request_failed
ignore_errors: True
- name: Verify fail if server is missing on request
assert:
that:
- request_failed is failed
- "'Missing required parameter' in request_failed.msg"