Skip to content

Commit 44a1472

Browse files
Added link0 and link1 to join command, also reworked building payload… (#172)
* Added link0 and link1 to join command, also reworked building payload to be consistent with creating clusters * Added changelog * Do not send cluster name to join call * password instead of api_password
1 parent 0d15777 commit 44a1472

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- proxmox_cluster - added link0 and link1 to join command (https://github.com/ansible-collections/community.proxmox/issues/168, https://github.com/ansible-collections/community.proxmox/pull/172).

plugins/modules/proxmox_cluster.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,17 @@ def cluster_create(self):
141141
self.module.exit_json(changed=True, msg="Cluster '{}' created.".format(cluster_name), cluster=cluster_name)
142142

143143
def cluster_join(self):
144-
master_ip = self.module.params.get("master_ip")
145-
fingerprint = self.module.params.get("fingerprint")
146-
api_password = self.module.params.get("master_api_password") or self.module.params.get("api_password")
147144
cluster_name = self.module.params.get("cluster_name")
145+
payload = {}
146+
147+
payload["hostname"] = self.module.params.get("master_ip")
148+
payload["fingerprint"] = self.module.params.get("fingerprint")
149+
payload["password"] = self.module.params.get("master_api_password") or self.module.params.get("api_password")
150+
151+
if self.module.params.get("link0") is not None:
152+
payload["link0"] = self.module.params.get("link0")
153+
if self.module.params.get("link1") is not None:
154+
payload["link1"] = self.module.params.get("link1")
148155
is_in_cluster = True
149156

150157
if self.module.check_mode:
@@ -161,11 +168,7 @@ def cluster_join(self):
161168
self.module.exit_json(changed=True, msg="Node would join the cluster '{}' (check mode).".format(cluster_name), cluster=cluster_name)
162169

163170
try:
164-
self.proxmox_api.cluster.config.join.post(
165-
hostname=master_ip,
166-
fingerprint=fingerprint,
167-
password=api_password
168-
)
171+
self.proxmox_api.cluster.config.join.post(**payload)
169172

170173
except Exception as e:
171174
self.module.fail_json(msg="Error while joining the cluster: {}".format(str(e)))

0 commit comments

Comments
 (0)