Ansible v2.2.1.0
I want to gather Ansible facts about a remote host defined in my inv/remote_hosts
file, which looks like this:
[remote-host-0]
10.22.123.234
[remote-host-1]
10.22.234.123
How do I run the setup command and tell it to gather facts for remote-host-0?
$ ansible ??? -m setup ???
If I simply do this:
$ ansible remote-host-0 -m setup
I get:
ERROR! Attempted to read "/path_to_my_ansible_dir/ansible//hosts" as YAML: Syntax Error while loading YAML.
It's looking for the wrong hosts file, and I get a YAML error.
You can specify an inventory file with the -i
option:
ansible remote-host-0 -m setup -i inv/remote_hosts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With