Centralizing authentication file for multiple Windows hosts using the same user credentials

I’m trying to figure out a way to reuse the same auth file for multiple windows hosts. It seems that when you specify a windows host in a playbook, such as [windows-webserver], it automatically looks for a file ‘group_vars/windows_webserver.yml’ for credentials. What if I have several hosts that all use the same credentials? Like…

[windows-webserver]
[windows-backend]
[windows-database]

It looks like Ansible needs a separate file for each of these with corresponding names under group_vars in order to authenticate - is this correct? Is there any way to centralize to a single auth file for all Windows hosts if they all have the same credentials?

Much appreciated,
-Joe

Hey.

Groups can have child groups, so the way I handle it is to have a high level group that just defines connection parameters, and then the more specialised groups such as Web servers or db servers get added as children of the high level group in my inventory .

You can also define group_vars/all if that makes sense for you.

Inventory looks a bit like this

[windows]

[win_db]
Windb1
Windb2

[win_web]
Winweb1
Winweb2

[windows:children]
win_db
win_web

Hope this helps

Jon