querry about ansible inventory

Hi Team,

how to create customized inventory [/etc/ansible/hosts] in such away it should ping both the fqdn and also with the server ip

ansible -m ping SERVER IP and also ansible -m ping FQDN