Describe the bug
When omitting the clusters: block section from the ntnx_foundation module the playbook throws an error however Foundation works as intended and only images the nodes. No errors occur in foundation.
The Clusters: block is marked as "not required" but the error that throws when NOT having it configured is forcing the Playbook to fail.
Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py", line 107, in <module>
_ansiballz_main()
File "/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.nutanix.ncp.plugins.modules.ntnx_foundation', init_globals=dict(_module_fqn='ansible_collections.nutanix.ncp.plugins.modules.ntnx_foundation', _modlib_path=modlib_path),
File "<frozen runpy>", line 226, in run_module
File "<frozen runpy>", line 98, in _run_module_code
File "<frozen runpy>", line 88, in _run_code
File "/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py", line 1290, in <module>
File "/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py", line 1286, in main
File "/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py", line 1281, in run_module
File "/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py", line 1247, in image_nodes
KeyError: 'clusters'
[WARNING]: Platform linux on host localhost is using the discovered Python interpreter at
/root/data/solutions/nutanix/nutanix.ansible/venv/bin/python3.11, but future installation of another
Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-
core/2.14/reference_appendices/interpreter_discovery.html for more information.
fatal: [localhost]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/root/data/solutions/nutanix/nutanix.ansible/venv/bin/python3.11"
},
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py\", line 107, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1694716468.608142-1548-105664984499090/AnsiballZ_ntnx_foundation.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.nutanix.ncp.plugins.modules.ntnx_foundation', init_globals=dict(_module_fqn='ansible_collections.nutanix.ncp.plugins.modules.ntnx_foundation', _modlib_path=modlib_path),\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py\", line 1290, in <module>\n File \"/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py\", line 1286, in main\n File \"/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py\", line 1281, in run_module\n File \"/tmp/ansible_ntnx_foundation_payload_0cmazq9c/ansible_ntnx_foundation_payload.zip/ansible_collections/nutanix/ncp/plugins/modules/ntnx_foundation.py\", line 1247, in image_nodes\nKeyError: 'clusters'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Expected behavior
When the Clusters Block is omitted (since it is not required) the expectation is that Foundation completes imaging the nodes, a cluster is not created, and the success message is displayed via the ansible output.
Describe the bug When omitting the
clusters:
block section from the ntnx_foundation module the playbook throws an error however Foundation works as intended and only images the nodes. No errors occur in foundation.The
Clusters:
block is marked as "not required" but the error that throws when NOT having it configured is forcing the Playbook to fail.To Reproduce Steps to reproduce the behavior:
Playbook:
Stack trace
The full traceback is:
Expected behavior When the Clusters Block is omitted (since it is not required) the expectation is that Foundation completes imaging the nodes, a cluster is not created, and the success message is displayed via the ansible output.
Additional context