[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

HI All,

For many ansible labs, i am getting this warning. And basicall that questions on checking goes to error.
Is there some issue or am i doing some mistake?
thor@ansible-controller ~/playbooks$ sh host_data.sh
node01 | CHANGED | rc=0 >>
11:49:38 up 30 min, 1 user, load average: 0.11, 0.11, 0.13

node00 | CHANGED | rc=0 >>
 11:49:38 up 30 min,  1 user,  load average: 0.11, 0.11, 0.13

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
match 'all'


PLAY [all] *********************************************************************************************************
skipping: no hosts matched

PLAY RECAP *********************************************************************************************************

thor@ansible-controller ~/playbooks$ cat host_data.sh
export ANSIBLE_GATHERING=explicit
ansible all -m shell -a uptime -i inventory
ansible-playbook /home/thor/playbooks/playbook.yml
thor@ansible-controller ~/playbooks$ catplays
bash: catplays: command not found
thor@ansible-controller ~/playbooks$ cat playbook.yml
- hosts: all
  tasks:
    - shell: cat /etc/redhat-release
thor@ansible-controller ~/playbooks$

on checking the answer : i get error: /home/thor/playbooks/playbook.yml not found or
script trying to run wrong playbook or
script is not printing OS version

note that i am using default ansible config file(/etc/ansible/ansible.cfg)
please help @mmumshad

@bhvk49

Hi! Can you check the path where you are running your playbook (pwd)
Also check Inventory file.

@bhvk49 You need to mention inventory file. Otherwise it will find in the default location /etc/ansible/ which is empty.