Automatic way to find where variables are coming from in Ansible

in flag

Whenever I have to change something in our Ansible repository, I have to check all the places where a variable could be set and that's very time consuming.

Is there something that would show me something like "the varialbe X being used in this template file is defined is all these places for host Y"?

br flag
No. It is not. It's up to you to keep track of [where the variables are coming from]( In fact, asking this question indicates that something is wrong with the structure of the data.
in flag
thanks for your useful answer, much appreciated
br flag
Post your [mre]( problem, instead. There might be options on how to improve the structure of the data or how to efficiently debug issues.
Zeitounator avatar
fr flag
Using an IDE with decent search functionalities should make this a breeze. Example for pycharm which I usually use for ansible development. Hitting `ctrl-shift-F`, selecting 'In project" and entering "my_variable_name:" (note the ending column) immediately gives me the list of files and the lines where that variable is set. The documentation site proposes a [list of IDEs and plugins]( Looking with grep is also a simple option: from your project root => `grep -Rn "my_variable_name:" *`

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.