Get List of Inventory Hosts that Match a patter

How can I enumerate all the host names in the inventory that match a particular pattern? For example, I would like to grab all the supervisors from this set. I want to use this list to configure something in a configuration file.

My dynamic inventory would return something like like this:

{

“vagrant”: [

“nimbus”,

“supervisor1”,

“supervisor2”,

“zookeeper”

],

“_meta”: {

“hostvars”: {

“nimbus”: {

“ansible_ssh_host”: “192.168.54.4”,

“ansible_ssh_user”: “vagrant”,

“ansible_ssh_private_key_file”: “.vagrant/machines/nimbus/virtualbox/private_key”

},

“supervisor1”: {

“ansible_ssh_host”: “192.168.54.5”,

“ansible_ssh_user”: “vagrant”,

“ansible_ssh_private_key_file”: “.vagrant/machines/supervisor1/virtualbox/private_key”

},

“supervisor2”: {

“ansible_ssh_host”: “192.168.54.6”,

“ansible_ssh_user”: “vagrant”,

“ansible_ssh_private_key_file”: “.vagrant/machines/supervisor2/virtualbox/private_key”

},

“zookeeper”: {

“ansible_ssh_host”: “192.168.54.3”,

“ansible_ssh_user”: “vagrant”,

“ansible_ssh_private_key_file”: “.vagrant/machines/zookeeper/virtualbox/private_key”

}

}

}

}