Windows and Groups

Hello–

Fairly new to Ansible and am starting to really dig into what I can do with it. I got my first server up and going using http://docs.ansible.com/ansible/intro_windows.html, but am concerned that I only seem to be able to connect to a system via WinRM if it is a member of an inventory group called windows. Is there a way I can have two host groups, say, [clients] and [servers] that I could sort my windows hosts into and manage them differently? I read some documentation on Inventory and it mentioned connection types, but windows is not listed as a connection type.

Thanks for any help anyone can provide

Allen

Hi Allen,
Windows is only meant as an example of a group. Nothing is stopping you from organizing your inventory like this, for example:
[clients]
client1

[servers]
server1

However, since Windows nodes require a winrm connection, you need to specify that for all windows nodes so that Ansible is aware of the fact that the node is running windows. You can do this in several ways:
option 1, continuing from the example above:

[clients]
client1

[servers]
server1

[clients:vars]
ansible_connection=winrm

[servers:vars]
ansible_connection=winrm

A more flexible approach is to have a “top-level” group where the common vars are stored, and then have your two groups “inherit” from that:

[windows]
[windows:children]
clients
servers

[clients]
client1

[servers]
server1

[windows:vars]
ansible_connection=winrm

again, the group name “windows” is just an example, it can be anything you like.

Hi Trond–

Thanks for the response. I was trying to figure out sub-groups yesterday thinking that may be the way to go.

Allen