Ansible Molecule how to use multiple group_vars

712 Views Asked by At

I have a folder structure like this in Ansible where global variables are at the root group_vars and then environment specific variables are in inventories/dev/group_vars/all etc.


.
├── ansible.cfg
├── group_vars
│   └── all
├── inventories
│   ├── dev
│   │   ├── group_vars
│   │   │   └── all
│   │   └── hosts
│   └── prod
│       ├── group_vars
│       │   └── all
│       └── hosts
└── playbook.yml

I want to use to be able reuse the existing variables in both var files in Molecule but unable to do so as it cannot find the variable. Something similar to the below works but I need both group_vars/all and inventories/dev/group_vars/all

extract of my molecule.yml

provisioner:
  name: ansible
  inventory:
    links:
      group_vars: ../../../group_vars

I tried comma separated and that doesn't work because afterall it's just a symlink to the file.

0

There are 0 best solutions below