Bootstrap FreeKB - Ansible - Resolve "Skipping unexpected key"
Ansible - Resolve "Skipping unexpected key"

Updated:   |  Ansible articles

Let's say something like this is being returned.

~]$ ansible-playbook example.yml --inventory inventory.yml

[WARNING]: Skipping unexpected key (foo) in group (groups), only "vars", "children" and "hosts" are valid
[WARNING]: Skipping unexpected key (bar) in group (groups), only "vars", "children" and "hosts" are valid
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

 

I got this when running the ansible-playbook command with the following inventory.yaml file.

---
hosts:
  server1.example.com:
    groups:
      - foo

  server2.example.com:
    groups:
      - bar

 

I resolved this by using the typical format for inventory YAML.

---
foo:
  hosts:
    server1.example.com:
bar:

  hosts:
    server2.example.com:



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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