Hi@akhtar,
You can use tags in your inventory file. It will act as a group of nodes. You can see the below example.
[web]
192.168.0.179   ansible_ssh_user=root   ansible_ssh_pass=redhat
[server]
192.168.0.180   ansible_ssh_user=root   ansible_ssh_pass=redhat
Now you can run Ansible command group-wise as shown below.
[root@localhost ~]# ansible web -m ping
192.168.0.179 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "ping": "pong"
}