Bootstrap FreeKB - Ansible - ansible ad hoc setup command
Ansible - ansible ad hoc setup command

Updated:   |  Ansible articles

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"

 

Here is how you would display facts for every managed node in your default hosts file or your own inventory file.

ansible all --module-name setup

 

Or against a specific managed node.

ansible all --module-name setup --limit server1.example.com

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0d396e in the box below so that we can be sure you are a human.