mirror of https://github.com/ansible/ansible.git
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.pull/53858/head
parent
980ca564ce
commit
a65a137cdd
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- name: Assign Floating IP to server test01
|
||||||
|
cloudscale_floating_ip:
|
||||||
|
ip_version: 6
|
||||||
|
server: '{{ test01.uuid }}'
|
||||||
|
reverse_ptr: '{{ cloudscale_resource_prefix }}-unassigned.example.com'
|
||||||
|
register: floating_ip
|
||||||
|
|
||||||
|
# The only way to have an unassigned floating IP is to delete the server
|
||||||
|
# where the floating IP is currently assigned.
|
||||||
|
- name: Delete server test01
|
||||||
|
cloudscale_server:
|
||||||
|
uuid: '{{ test01.uuid }}'
|
||||||
|
state: 'absent'
|
||||||
|
|
||||||
|
- name: Do not fail if floating IP is unassigned
|
||||||
|
cloudscale_floating_ip:
|
||||||
|
ip: '{{ floating_ip.ip }}'
|
||||||
|
register: floating_ip_not_fail
|
||||||
|
- name: Verify do not fail if floating IP is unassigned
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- floating_ip_not_fail is successful
|
||||||
|
- floating_ip_not_fail is not changed
|
||||||
|
- floating_ip_not_fail.server == None
|
Loading…
Reference in New Issue