Ansible - url check for multiple hosts

I am writing the Ansible playbook to check the URL status for multiple IPs from the hosts file, however, it is not working when I am giving input as a group_name, but is working for single IP.

Here is my playbook,

Try

  • name: check the url http://{{ inventory_hostname}}:{{ port }}/test

Thanks, this is working.