ansible_connection ansible_user

Hello,

I’m new to ansible and struggle to find a way create a role that could install application both on Windows and Linux os. I’m having problem to allocate correct ansible_connection ansible_user. It seems like if I set in vars connection parameters for Windows that affects Linux access and vice-versa if default settings are used. Is there a way to use variables for connection in a smart way. I was thinking abot option where one type of connection settings is used (winrm) and if not successful use default (ssh). Currently I update my inventory file without assigning any new host to specific OS group so I don’t know which host uses Linux and which Windows.

I would appreciate any help or maybe examples, references to resources specific to this problem

Best regards,

Rafal