provide custom host file in ansible ping code example Example: Ansible ping hosts $ ansible <hostgroup-name> -m ping