Skip to content

Commit a75c19d

Browse files
fix(ansible): show cluster identity instead of first node in cluster_info (#44)
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>).
1 parent 5f8f7f7 commit a75c19d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

ansible/cluster_info.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
connection: local
1515

1616
tasks:
17-
# -- Step 1: Get cluster version ------------------------------------
18-
- name: Get cluster info
17+
# -- Step 1: Get cluster identity ------------------------------------
18+
- name: Get cluster identity
1919
netapp.ontap.na_ontap_rest_info:
2020
hostname: "{{ ontap_hostname }}"
2121
username: "{{ ontap_username }}"
@@ -24,17 +24,17 @@
2424
validate_certs: "{{ ontap_validate_certs }}"
2525
use_rest: always
2626
gather_subset:
27-
- cluster/nodes
27+
- cluster
2828
fields:
29+
- "name"
2930
- "version"
3031
register: cluster_result
31-
no_log: false
3232

3333
- name: Display cluster version
3434
ansible.builtin.debug:
3535
msg: >-
36-
Cluster node: {{ cluster_result.ontap_info['cluster/nodes']['records'][0].name | default('unknown') }}
37-
— ONTAP {{ cluster_result.ontap_info['cluster/nodes']['records'][0].version.full | default('unknown') }}
36+
Cluster: {{ cluster_result.ontap_info.cluster.name | default('unknown') }}
37+
— ONTAP {{ cluster_result.ontap_info.cluster.version.full | default('unknown') }}
3838
3939
# -- Step 2: List nodes with serial numbers -------------------------
4040
- name: Get node details

0 commit comments

Comments
 (0)