Skip to content

fix(ansible): show cluster name in cluster_info playbook#44

Merged
hvinn merged 1 commit into
NetApp:mainfrom
jainpiyush111:fix/ansible-cluster-info-show-cluster-name
May 22, 2026
Merged

fix(ansible): show cluster name in cluster_info playbook#44
hvinn merged 1 commit into
NetApp:mainfrom
jainpiyush111:fix/ansible-cluster-info-show-cluster-name

Conversation

@jainpiyush111
Copy link
Copy Markdown
Contributor

Summary

ansible/cluster_info.yml Step 1 was querying cluster/nodes and using
the first node's name as if it were the cluster name, producing output
like Cluster node: <cluster>-vm-01. The version field was also
missing from fields, so the version rendered as unknown once the
display task was corrected.

This mirrors the same class of bug already fixed for the Python
example in #.

Change

Switch Step 1 to query the cluster subset directly and request both
name and version:

-        gather_subset:
-          - cluster/nodes
-        fields:
-          - "version"
+        gather_subset:
+          - cluster
+        fields:
+          - "name"
+          - "version"

And update the display task to read from the corrected path:

-      Cluster node: {{ cluster_result.ontap_info['cluster/nodes']['records'][0].name | default('unknown') }}
-      — ONTAP {{ cluster_result.ontap_info['cluster/nodes']['records'][0].version.full | default('unknown') }}
+      Cluster: {{ cluster_result.ontap_info.cluster.name | default('unknown') }}
+      — ONTAP {{ cluster_result.ontap_info.cluster.version.full | default('unknown') }}

Before

TASK [Display cluster version]
ok: [cluster1] => {
    "msg": "Cluster node: FsnIdoci-46023003xxxx-vm-01 — ONTAP NetApp Release 9.19.1..."
}

After

TASK [Display cluster version]
ok: [cluster1] => {
    "msg": "Cluster: FsnIdoci-4602300xxxx — ONTAP NetApp Release 9.19.1..."
}

Testing

  • ansible-playbook --syntax-check ansible/cluster_info.yml -i ansible/inventory/hosts.yml passes.
  • Ran end-to-end against a 2-node ONTAP 9.19.1 simulator; output matches the Python example.

Checklist

  • ansible-playbook --syntax-check passes for the modified file
  • Tested against a live cluster
  • No new dependencies
  • Scope limited to ansible/cluster_info.yml

@github-actions
Copy link
Copy Markdown

Test Report missing or unfilled.

This PR touches python/, ansible/, or terraform/, so a populated Test Report section is required in the PR body. See TESTING.md for what to capture (environment, platform version, first-run output, idempotency check, teardown).

This is a soft gate - your CI checks are unaffected - but reviewers will not approve until the report is filled in.

…info

The Step 1 task used gather_subset: cluster/nodes and rendered
records[0].name, which is a node name (e.g. ...-vm-01), not the
cluster name. The version field was also omitted from fields, so
ONTAP returned no version data and the message showed 'unknown'.

Switch to gather_subset: cluster, request name and version, and
read from cluster_result.ontap_info.cluster. Output now matches
the Python example (Cluster: <name> - ONTAP <version>).
@hvinn hvinn force-pushed the fix/ansible-cluster-info-show-cluster-name branch from 82e1176 to 0163478 Compare May 22, 2026 07:06
@hvinn hvinn merged commit a75c19d into NetApp:main May 22, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants