New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty hosts declaration in YAML inventory causes partial fallback to INI parsing #34760
Comments
Files identified in the description: If these files are inaccurate, please update the |
cc @bcoca |
This also affects 2.5.
|
Can confirm the issue is still there in 2.6.4 |
Can confirm the issue still exists in 2.7.5 |
Files identified in the description: If these files are incorrect, please update the |
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
!component =lib/ansible/plugins/inventory/yaml.py |
!needs_collection_redirect |
Files identified in the description: If these files are incorrect, please update the |
ISSUE TYPE
COMPONENT NAME
inventory
ANSIBLE VERSION
CONFIGURATION
default environment, no config or envvars
OS / ENVIRONMENT
running from MacOS 10.12.6
managing N/A
SUMMARY
YAML inventories where a group contains a "hosts:" group, but no hosts exist inside the group cause ansible to interpret the file partially as just a list of hosts, without warning.
STEPS TO REPRODUCE
Running
ansible all --list-hosts
against the following inventory file lists 10 hosts, when it should only list 3.Note that "group1" contains a "hosts" entry, but there are no hosts listed. If you delete that line, the inventory file works correctly.
EXPECTED RESULTS
ACTUAL RESULTS
Note that, somehow, both "host1" and "host1:" are included, which seems to indicate that it's somehow parsing it as YAML and as INI.
The text was updated successfully, but these errors were encountered: