From ed038a1116f0f88fad35285c9bcdde4fd4dc33d7 Mon Sep 17 00:00:00 2001 From: shaerpour Date: Mon, 5 May 2025 13:38:05 +0330 Subject: [PATCH] fix: Don't detach volume if no server defined and volume already attached to another server --- plugins/modules/volume.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py index 1bcb442..118dc4c 100644 --- a/plugins/modules/volume.py +++ b/plugins/modules/volume.py @@ -244,12 +244,6 @@ class AnsibleHCloudVolume(AnsibleHCloud): action = self.hcloud_volume.attach(server, automount=automount) action.wait_until_finished() self._mark_as_changed() - else: - if self.hcloud_volume.server is not None: - if not self.module.check_mode: - action = self.hcloud_volume.detach() - action.wait_until_finished() - self._mark_as_changed() labels = self.module.params.get("labels") if labels is not None and labels != self.hcloud_volume.labels: