Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cluster URL to response only when there is cluster creation #402

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading