Open nx-sbourdeaud opened 1 year ago
@abhimutant Please check this, thanks.
Moving it to 1.9.2 due to unavailability of fix. Reminder: @abhimutant please can you check this, thanks
I'm seeing a similar issue with ntnx_clusters_info and ntnx_hosts_info with both filter and custom_filter. Is this related?
Setting a filter name: "{{ cluster_name }}"
with the ntnx_clusters_info module retrieves all clusters. Similarly, with ntnx_hosts_info, setting a filter cluster_name: "{{ cluster_name }}"
retrieves all hosts.
ntnx_vms_info, however, filters correctly with cluster_name: "{{ cluster_name }}"
.
For example, this returns all clusters
---
[...]
tasks:
- name: Get cluster info
nutanix.ncp.ntnx_clusters_info:
nutanix_host: "{{ prism_host }}"
nutanix_username: "{{ prism_username }}"
nutanix_password: "{{ prism_password }}"
filter:
name: "{{ cluster_name }}"
register: cluster_info
The work around I have is
- name: Get cluster info
nutanix.ncp.ntnx_clusters_info:
nutanix_host: "{{ prism_host }}"
nutanix_username: "{{ prism_username }}"
nutanix_password: "{{ prism_password }}"
filter:
name: "{{ cluster_name }}" # DOES NOT WORK
register: all_clusters
- name: Get cluster
set_fact:
cluster: "{{ (all_clusters.response.entities | selectattr('status.name', '==', cluster_name ) | first) }}"
- name: Get hosts
nutanix.ncp.ntnx_hosts_info:
nutanix_host: "{{ prism_host }}"
nutanix_username: "{{ prism_username }}"
nutanix_password: "{{ prism_password }}"
filter:
cluster_name: "{{ cluster_name }}" # DOES NOT WORK
register: all_hosts
- name: Get hosts info
set_fact:
hosts: "{{ all_hosts.response.entities | selectattr('status.cluster_reference.uuid', '==', cluster.metadata.uuid ) }}"
Describe the bug Using custom_filter has not effect on the result/output (all imaged nodes are displayed)
To Reproduce Steps to reproduce the behavior:
ansible-playbook imaged_nodes_info.yml
sample playbook used:
Expected behavior Only nodes whose properties match the custom filter should be returned.