$ ansible 192.168.254.150 -m ping
[WARNING]: Unable to parse /etc/ansible/hosts enable callback plugins as an
inventory source
[WARNING]: Unable to parse /etc/ansible/they can output to stdout but cannot be
'stdout' type. callback_whitelist = timer as an inventory source
[WARNING]: Unable to parse /etc/ansible/mail as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: 192.168.254.150
-
Hi Tazhar - we're going to need a bit more information than just the shell output. What version of ansible are you running? Do you have ssh keys set up? what kind of host is the target? etc– Bruce BeckerMar 12, 2020 at 9:42
1 Answer
Try this, to run an adhoc command with IP address
ansible all -i 192.168.254.150, -m ping
192.168.254.150 | SUCCESS => {
"changed": false,
"ping": "pong"
}
From man:
-i INVENTORY, --inventory=INVENTORY, --inventory-file=INVENTORY specify inventory host path or comma separated host