Reputation: 536
My inventory directory structure looks like this
./group_vars
./group_vars/all
./inventory
./inventory.py
I have static inventory and dynamic inventory script, and group_vars/all has some variables that I would like to access inside inventory.py, is there a way to achieve this, or any information on how a structure like this gets parsed by ansible?
Upvotes: 2
Views: 498
Reputation: 556
Update your inventory.py
and use pyyaml to load the group_vars/all.yml
Example code:
import yaml
document = """
a: 1
b:
c: 3
d: 4
"""
print yaml.dump(yaml.load(document))
Upvotes: 2