mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
hetzner changed image tag for server, so its working with ids and names (#56406)
* hetzner changed image tag for server, so its working with ids and names * changed trailing whitespace * added higher retries count since server creation from own image takes a lot longer
This commit is contained in:
parent
666dfdc551
commit
3b08e75eb2
1 changed files with 6 additions and 2 deletions
|
@ -234,10 +234,14 @@ class AnsibleHcloudServer(Hcloud):
|
|||
"server_type": self.client.server_types.get_by_name(
|
||||
self.module.params.get("server_type")
|
||||
),
|
||||
"image": self.client.images.get_by_name(self.module.params.get("image")),
|
||||
"user_data": self.module.params.get("user_data"),
|
||||
"labels": self.module.params.get("labels"),
|
||||
}
|
||||
if self.client.images.get_by_name(self.module.params.get("image")) is not None:
|
||||
# When image name is not available look for id instead
|
||||
params["image"] = self.client.images.get_by_name(self.module.params.get("image"))
|
||||
else:
|
||||
params["image"] = self.client.images.get_by_id(self.module.params.get("image"))
|
||||
|
||||
if self.module.params.get("ssh_keys") is not None:
|
||||
params["ssh_keys"] = [
|
||||
|
@ -266,7 +270,7 @@ class AnsibleHcloudServer(Hcloud):
|
|||
if not self.module.check_mode:
|
||||
resp = self.client.servers.create(**params)
|
||||
self.result["root_password"] = resp.root_password
|
||||
resp.action.wait_until_finished()
|
||||
resp.action.wait_until_finished(max_retries=1000)
|
||||
[action.wait_until_finished() for action in resp.next_actions]
|
||||
self._mark_as_changed()
|
||||
self._get_server()
|
||||
|
|
Loading…
Reference in a new issue