Reputation: 2491
This might be a trivial or a duplicate question, but i seem to have exhausted my search and unable to properly frame a query to search, and so here i am with the question.
How to evaluate a value of a variable inside parentheses.
Below is my vars file
patch_version: 6.4
patch_list:
patch_type1:
6.4:
id: 123
feature: 123
And below is the how i am trying to evaluate
{{ patch_list.patch_type1.{{ patch_version }}.id }}
Unfortunately, there is a number with a decimal point in it, and that's giving me headache.
Any suggestions?
Upvotes: 1
Views: 542
Reputation: 68179
Put the attribute into the brackets. For example
- debug:
msg: "{{ patch_list.patch_type1[patch_version].id }}"
gives
"msg": "123"
Upvotes: 1