mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
Fix idempotency
This commit is contained in:
parent
fe84174cb6
commit
be6213f6e0
1 changed files with 2 additions and 2 deletions
|
|
@ -259,7 +259,7 @@ class AnsibleHcloudFloatingIP(Hcloud):
|
|||
self._mark_as_changed()
|
||||
|
||||
server = self.module.params.get("server")
|
||||
if server is not None:
|
||||
if server is not None and server != self.hcloud_floating_ip.server.name:
|
||||
if self.module.params.get("force") or self.hcloud_floating_ip.server is None:
|
||||
if not self.module.check_mode:
|
||||
self.hcloud_floating_ip.assign(
|
||||
|
|
@ -267,7 +267,7 @@ class AnsibleHcloudFloatingIP(Hcloud):
|
|||
)
|
||||
else:
|
||||
self.module.warn(
|
||||
"Floating IP is already assigned to server %s. You need to unassign the Floating IP or use force=yes."
|
||||
"Floating IP is already assigned to another server %s. You need to unassign the Floating IP or use force=yes."
|
||||
% self.hcloud_floating_ip.server.name
|
||||
)
|
||||
self._mark_as_changed()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue