In a large enviroment, with duplicated stacks, why use group_vars and host_vars instead of vars_files ?

Hi all,
I’m fine tuning roles for our farm.
we started with group_vars and host_vars, but it results dispersive, lot of file in group_vars and more important number of files in host_vars.
We changed all to use vars_files, and now we have 2 files, one for credentials and one for all the other variables.

My question is, we don’t understand how to right use of group_vars and host_vars? Because they are in best practices, we there aren’t vars_files.

thanks all for answers.

Not understanding the question but we really love group_vars/ and host_vars/ a lot here.

vars_files is more like if your play wants to bring in variables for that specific play, rather than describing info about those hosts.

I like group_vars and host_vars.

Using group_vars and host_vars, we have a lot of files for hosts.
But, if we use group_vars, and vars_files, we can reduce drastically the number of files, in one or two file, one for credentials and one for other variables .
vars_files are not described in best practice, why ? why have lot of host_vars, divided in files for hosts instead of one file included by vars_files ?
with vars_files we can simplify the manitenance.
So we aren’t understanding the use of host_vars ?

If your variable information is about multiple hosts, it belongs in group_vars not host_vars. Consider applying more groups if you wish to include them.

vars_files is definitely subscribed, but most people set variables in roles now, rather than in the play at the top.

You are welcome to use whatever works for you. Every environment is different.