How can I dynamically change an Ansible variable?

Question:

I have this in vars:

Now I want to dynamically change var3: "{{var2}}".

I can assign var3: "test2". But how can I assign var3: "{{var2}}"?

Answer:

My attempt at the interpretation of the phrase “dynamically change Ansible variable” based on your question:

Variables assigned through a set_fact module are in their own class of variables which has a lower priority only to block vars, task vars and extra vars. See Variable Precedence.

Leave a Reply