The ansible ad-hoc command with the -m or --module-name option can be used to gather facts. Facts are raw data about a system, such as the systems hostname and IP address. For example, here is how you would display your control node (that's your Ansible server) facts.
ansible localhost --module-name setup
Here is a snippet of some of the facts that should be returned.
"ansible_hostname": "server1" "ansible_all_ip4v_addresses": "10.1.2.3" "ansible_distribution": "CentOS"
ansible all --module-name setup