How do you use ec2 dynamic inventory with windows instances?

I’ve been playing with ansible and have everything working for managing linux instances via dynamic inventory in ec2, I have also set up windows support when using a fix hosts file.

When I try to use ec2 dynamic inventory to manage windows instances it seems to flip back to trying SSH for access.

Currently I have a simple playbook:

`

doh!

I solved it by creating a group_vars file with the same name as one of my hosts tags

group_vars\tag_type_iisserver.yml

I am curious to know what your hosts file and group_vars\tag_type_iisserver.yml look like. I am trying to add dynamic hosts to my static windows group in /etc/ansible/hosts using the following syntax
[tag_name_xzy]

[windows:children]
tag_name_xyz

as shown in the documentation and the result is : “No hosts matched” even though ec2.py does return a few hosts under the section [tag_name_xyz]. It’s driving me crazy. Any help is appreciated.
Thanks

Did you ever figure this out? I’m currently getting “no hosts matched”. Any tips would be great!

To anyone who finds this and has the same problem, here’s how it works:

My playbook (myplaybook.yml)

  • name: Do some stuff to windows servers

hosts: tag_OS_windows2012r2

gather_facts: false

connection: local

tasks:

  • name:

win_file:

path: C:\foobar.txt

state: touch

I also created a folder / file group_vars/tag_OS_windows2012r2.yml (note this file name is the same as my hosts in the playbook)

ansible_connection: winrm

ansible_ssh_port: 5986

ansible_ssh_user: Administrator

ansible_ssh_pass: mypassword123

And then call your playbook with ec2.py (and AWS profiles, if you use that)

AWS_PROFILE=main ansible-playbook -i /etc/ansible/ec2.py myplaybook.yml