Details
-
Type: Task
-
Status: Closed (View Workflow)
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Labels:None
-
Story Points:0.25
-
Epic Link:
-
Sprint:Spring 7 : 13 Apr to 24 Apr
Description
A quick question:
In a "vars" file in ansible, can you refer to another variable defined in the same file?
For example, can you do the following?
var1: hello
var2: world
var3: "{{ var1 }} var2"
That is, what I would like to do is define a variable and then use it to define additional variables elsewhere in a variables file.
For example, I would like to be able to define "ec2_name" and then re-use it to define the name of the appstore database:
ec2_name: appstore123
...
rds_db_name: "{{ ec2_name }}"
Do you know: Is this legal in ansible?
Asking because you might know the answer off-hand. I have not had much luck searching google for the answer.
If you don't know it off-hand, just add that as a comment in the ticket. No need to do a lot of deep dive research.