Specifying WIndows systems in a mixed host environment

23 views
Skip to first unread message

Hunter Tom

unread,
Oct 11, 2018, 8:17:07 PM10/11/18
to Ansible Project
Hello All:
Please help!
Problem -

I have a hosts file separated out with different branches of an organization as such:
[branch01]
server01
server02
server03
[branch02]
server04
server05
....etc

The problem is that if server01 and server05 are windows, how do I specify to use WinRM?

I've tried the following:
Is there a way to dynamically switch from SSH to WINRM based on the way I have my hosts set up?

Jordan Borean

unread,
Oct 12, 2018, 12:39:06 AM10/12/18
to Ansible Project
Easiest way is to create a Windows group, define the connection plugin in that group, and finally add your Windows hosts as children of that group;

[windows:children]
server01
server03
branch02
....

[windows:vars]
ansible_connection
=winrm

You can add some more values to configure WinRM if you wish but by default you at least need to tell Ansible to use the winrm connection plugin.

Hunter Tom

unread,
Oct 12, 2018, 9:26:23 AM10/12/18
to Ansible Project
Okay, thanks. I was trying to ensure against putting the host name twice to ensure against confusion. I guess I will separate the branches futher by [branch01_linux] and [branch01_windows]...ect. Thanks for the clarification. I just wish I could use logic ('if unable to connect ssh then try winrm') against my hosts
Reply all
Reply to author
Forward
0 new messages