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/legacy/roles/cloudscale_floating_ip/tasks/floating_ip.yml
Gaudenz Steinlin a23da23491 cloudscale_floating_ip module (#33181)
* Refactor cloudscale API code

Move code common to all cloudscale cloud modules into a common base
class.

This is needed as a prepartion of the cloudscale_floating_ip module.

* cloudscale_floating_ip module

New cloud module to manage floating IPs on the cloudscale.ch IaaS
service.
2017-12-11 14:48:35 +00:00

94 lines
2.6 KiB
YAML

- name: Request 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) }}'
register: floating_ip
- name: Verify request floating IP
assert:
that:
- floating_ip | success
- floating_ip | changed
- (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 indempotence
cloudscale_floating_ip:
server: '{{ test01.uuid }}'
ip: '{{ floating_ip.ip }}'
register: floating_ip_indempotence
- name: Verify floating IP indempotence
assert:
that:
- floating_ip_indempotence | success
- not floating_ip_indempotence | changed
- floating_ip_indempotence.server == test01.uuid
- 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 | success
- 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 | success
- move_ip | 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 | 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 | success
- release_ip | changed
- release_ip.state == 'absent'
- name: Release floating IP indempotence
cloudscale_floating_ip:
ip: '{{ floating_ip.ip }}'
state: 'absent'
register: release_ip
- name: Verify release floating IPs indempotence
assert:
that:
- release_ip | success
- not release_ip | 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 | failed
- "'Missing required parameter' in request_failed.msg"