-
Notifications
You must be signed in to change notification settings - Fork 667
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
Switch from inventory file to directory for testinfra call #2962
Switch from inventory file to directory for testinfra call #2962
Conversation
(should respect linked hosts and allow to use `hostvars[linked_host]`).
@amarao Does this break users that do not have a directory? Ansible allows both files or directory approach and if we implement support for folders while breaking the flat-inventory users we are in bit trouble, especially because the number of users using simple inventories is greater. |
👍 to what @ssbarnea said, I'd like know this doesn't break existing use-cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we configure the provisioner with both file and directory support?
@ssbarnea, When molecule constructs inventory, it writes As far as I understand ansible, there is no difference between inventory file and an inventory directory with the same file inside. Ansible reads all yaml files from the inventory directory, so 'inventory file' is used in both cases. The difference is only if there are additional files. (This is the case with 'linked' hosts and group/hostvars directories). Group vars and Host vars are not affected, because host_group_vars plugin is searching them in both cases (file and directory). If user used only constructed inventory (no links), then Ansible will read directory with a single file, no issues. The single issue I found is that tests may start to run against linked host, but it's easily solved:
(I have 'hypervisor' linked host and vms are provisioned and tested). |
PR Type
It should allow to use hostvars of non-managed hosts inside testinfra call (including delegation). See Issue #2961 for details.