[Question] Do dynamic inventories work with static inventories + group_vars

I have a static inventory file similar to

[production:children]
elasticsearch

[elasticsearch]

I have a dynamic inventory file that follows the guidance at

  1. https://www.jeffgeerling.com/blog/creating-custom-dynamic-inventories-ansible
  2. https://docs.ansible.com/ansible/intro_dynamic_inventory.html#dynamic-inventory

I have group_vars defined for production.

What I was hoping would happen is that the dynamic inventory would pick up the parent groups and in turn pick up the group vars. This is what happens for static inventories.

That is not the case though, I receive undefined errors for the vars defined in production

- debug: msg="{{ group_names }}"
  tags: [always]

but the result is just

TASK [elasticsearch : debug] ***************************************************
task path: /roles/elasticsearch/tasks/main.yml:2
ok: [scrubbed] => {
“msg”: [
“elasticsearch”
]

NVM.

I sorted this out by combining my dynamic and static inventories into a dir, then passing that dir as the -i flag.