Answer the question
In order to leave comments, you need to log in
How to dynamically get a dictionary by variable name?
Hey!
there is a set of dictionaries
project1_defaults:
someprop: somevalue
project1_specific:
someprop: somavalue
---
project2_defaults:
...
project2_specific:
...
Answer the question
In order to leave comments, you need to log in
I don't know about prettiness, but this is
ansible.builtin.vars - Lookup templated value of variables
https://docs.ansible.com/ansible/latest/collection...
It should suit you
Thanks, this is a great option.
In the call of the role from the playbook stuck
vars:
project: "{{ lookup('vars', app)}}"
project_specific: "{{ lookup('vars', app + '_specific' )}}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question