Ansible switch Configuration

I have a main Ansible playbook “Vlan_configuration.yml “ . I have a ticketing tool “Solve “ which is as similar as Service now . I have a list of network switches present in the drop-down of “ Network Switches “ .there are 200 list of network switches . Now , I have different roles called inside a main playbook and the one role is “Manage_Engine_Update “ . I have created a task inside this role which is “api_test”.yml … now I have a url which fetches all the details of network switches and the output is present in the JSON format of “request_data “. this output has all switch attributes like switch name , switch ip address . Request_data is the name of the register … Now my question is , I need to create a variable such that whenever the user selects any network switches in the drop-down , I should have the list of available network switches present in the variable so that whenever user selects from the ticketing tenplate , it should check from the variable and if it is found , it will fetch the ip address of that particular switch from the “request_data “ register .

I want to create a variable that should have the list of the available network switches , if I am able to create a variable , then I can compare this variable with the available list of switch names whatever user will be selecting . If that gets compared and the switch is found , we can get the ip address of the particular switches …I don’t know how to create that . I am not getting any idea , for it … can anyone let me know , how can we create the variable for all the network switches ?