The ‘filter_key’ is nothing but the attributes present on the get details output for any the respective entity. Say for example volume will have the below attributes
Get Volume details output through ansible volume module:
For volumes, these following keys can be used as a filter_key: cap_gb, cap_mb, num_of_storage_groups, type, volumeId, volume_identifier, wwn, etc.
For the Storage group, the following keys can be used as a filter_key: cap_gb, compression, num_of_child_sgs, num_of_masking_views, num_of_parent_sgs, num_of_snapshots, num_of_vols, , slo, slo_compliance, storageGroupId, unprotected, etc.
Now in filter_keys any of these attributes can be passed as input. A similar approach also applies to other gather_subset entities like mv, host, srp, etc. There are examples provided along with the module, you may refer to any of these for understanding the filter functionality. Here are a few examples for your reference.
The following playbook syntax will give the list of all TDEV types volumes
The ‘filter_key’ is nothing but the attributes present on the get details output for any the respective entity. Create a test playbook on an existing MV, PG, IG, resource and view the results to see the attributes/keys
Anil_Degwekar
13 Posts
949
0
Posted May 3rd, 2021 00:00
Try this:
filters:
- filter_key: "storageGroupId"
filter_operator: "like"
filter_value: "ansible_sg"
OR
filters:
- filter_key: "storageGroupId"
filter_operator: "equal"
filter_value: "ansible_sg"
The first one will filter all storage groups whose names start with 'ansible_sg'. The second one will look for exact match of the storage group name.