Ansible - ansible ad hoc setup command

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": ""
"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


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |