Zend certified PHP/Magento developer

Ansible hosts not working using specified inventory

I have two files

inventory.yaml:

servers:
  hosts:
    nas:
      ansible_host: 10.10.10.27
    router:
      ansible_host: 10.10.10.1

and playbook.yaml

- name: pylonl playbook
  hosts: all
  tasks:
    -name: Ping all hosts
     ansible.builtin.ping:

running ansible -i inventory.yaml all -m ping works, but running ansible -i inventory.yaml playbook.yaml returns:

[WARNING]: Could not match supplied host pattern, ignoring: playbook.yaml
[WARNING]: No hosts matched, nothing to do

what am i missing?