Skip to content

Commit

Permalink
Add cluster URL to response only when there is cluster creation (#402)
Browse files Browse the repository at this point in the history
* Create cluster url when it is required

* Minor fix
  • Loading branch information
bhati-pradeep authored Oct 25, 2023
1 parent 0bc4af7 commit 73e846b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/ntnx_foundation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
description: 'Nutanix module to image nodes and optionally create clusters'
options:
hypervisor_nameserver:
description: to-write
description: name server for hypervisors
type: str
required: false
cvm_gateway:
Expand Down Expand Up @@ -1244,7 +1244,7 @@ def image_nodes(module, result):

# add cluster urls if any cluster created
cluster_urls = []
if spec["clusters"]:
if spec.get("clusters"):
for cluster in spec["clusters"]:
cluster_urls.append(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,43 @@
fail_msg: " Fail : unable to create spec for imaging nodes"
success_msg: "Succes: spec generated successfully"

- name: Image nodes without cluster creation
ntnx_foundation:
timeout: 4500
cvm_gateway: "{{cvm_gateway}}"
cvm_netmask: "{{cvm_netmask}}"
hypervisor_gateway: "{{hypervisor_gateway}}"
hypervisor_netmask: "{{hypervisor_netmask}}"
default_ipmi_user: "{{default_ipmi_user}}"
current_cvm_vlan_tag: "{{nodes.current_cvm_vlan_tag}}"
nos_package: "{{images.aos_packages[0]}}"
blocks:
- block_id: "{{nodes.block_id}}"
nodes:
- manual_mode:
cvm_ip: "{{nodes.node2.cvm_ip}}"
cvm_gb_ram: 50
hypervisor_hostname: "{{nodes.node2.hypervisor_hostname}}"
ipmi_netmask: "{{nodes.node2.ipmi_netmask}}"
ipmi_gateway: "{{nodes.node2.ipmi_gateway}}"
ipmi_ip: "{{nodes.node2.ipmi_ip}}"
ipmi_password: "{{nodes.node2.ipmi_password}}"
hypervisor: "{{nodes.node2.hypervisor}}"
hypervisor_ip: "{{nodes.node2.hypervisor_ip}}"
node_position: "{{nodes.node2.node_position}}"
register: result
no_log: true
ignore_errors: True

- name: Creation Status
assert:
that:
- result.response is defined
- result.failed==false
- result.changed==true
fail_msg: " Fail : unable to image nodes"
success_msg: "Succes: node imaging done successfully"

- name: Image nodes and create cluster out of it
ntnx_foundation:
timeout: 4500
Expand Down

0 comments on commit 73e846b

Please sign in to comment.