Start a Conversation

Unsolved

5 Posts

1045

April 29th, 2021 08:00

Need lsit of available filters for SG in Ansible for Powermax modules

Need to filter out only SG names for example ansible_sg only instead of entire list

 

 

dellemc_powermax_gatherfacts:
    unispherehost: "{ {unispherehost}}"
    universion: "{ {universion}}"
    verifycert: "{ {verifycert}}"
    user: "{ {user}}"
    password: "{ {password}}"
    serial_no: "{ {serial_no}}"
    gather_subset:
      - vol
    filters:
      - filter_key: "sg"
        filter_operator: "equal"
        filter_value: "ansible_sg"
     

 

 

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.

 

72 Posts

May 3rd, 2021 07:00

Hello DMASAND,

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:

"volume_details": {
        "allocated_percent": 0,
        "cap_cyl": 547,
        "cap_gb": 1.0,
        "cap_mb": 1026.0,
        "effective_wwn": "60000970000297900330533032313833",
        "emulation": "FBA",
        "encapsulated": false,
        "has_effective_wwn": false,
        "mobility_id_enabled": false,
        "num_of_front_end_paths": 0,
        "num_of_storage_groups": 1,
        "pinned": false,
        "reserved": false,
        "snapvx_source": false,
        "snapvx_target": false,
        "ssid": "FFFFFFFF",
        "status": "Ready",
        "storageGroupId": [
            "Ansible_SG_3_Test"
        ],
        "storage_groups": [
            {
                "storage_group_name": "Ansible_SG_3_Test"
            }
        ],
        "type": "TDEV",
        "volumeId": "02183",
        "volume_identifier": "Ansible_SG_3_vol_1_Test",
        "wwn": "60000970000297900330533032313833"
    }

Similarly, the storage group will have below attributes

Get Storage Group details output through ansible Storage Group module:

"storage_group_details": {
        "cap_gb": 1.0,
        "compression": false,
        "device_emulation": "FBA",
        "num_of_child_sgs": 0,
        "num_of_masking_views": 0,
        "num_of_parent_sgs": 0,
        "num_of_snapshots": 0,
        "num_of_vols": 1,
        "slo": "NONE",
        "slo_compliance": "NONE",
        "storageGroupId": "Ansible_SG_3_Test",
        "type": "Standalone",
        "unprotected": true
    },
    "storage_group_volumes": [
        "02183"
    ],
    "storage_group_volumes_details": [
        {
            "effective_wwn": "60000970000297900330533032313833",
            "type": "TDEV",
            "volumeId": "02183",
            "volume_identifier": "Ansible_SG_3_vol_1_Test",
            "wwn": "60000970000297900330533032313833"
        }
    ]
}

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

gather_subset:
           - vol
        filters:
           - filter_key: "cap_gb"
             filter_operator: "greater"
             filter_value: "10"

The following playbook syntax will give the list of storage groups those have “ansible” as substring in key storageGroupId

      gather_subset:
        - sg
      filters:
        - filter_key: "storageGroupId"
          filter_operator: "like"
          filter_value: "Ansible_SG"

The following playbook syntax will give a storage group with “equal” filter on key “compression”

      gather_subset:
        - sg
      filters:
        - filter_key: "compression"
          filter_operator: "equal"
          filter_value: "False"

Hope this helps.
Bryan

5 Posts

May 3rd, 2021 10:00

Thanks a lot . will try it out Can i get list of all filter_keys used in  "dellemc_powermax_gatherfacts" module

5 Posts

May 3rd, 2021 10:00

Thanks Bryan 

 

 - filter_key: "storageGroupId" is what i was looking for .....

Can i get few other filter key for masking view, port group, hostgroup names 

72 Posts

May 4th, 2021 08:00

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
No Events found!

Top