Hosts = all, One simple Task - but for multi platform (Windows WinRM + SSH)

Hi Group,

Wonder if someone have a feedback on the following issue:

I’m creating two machine in EC2 - One is Windows and the other is Linux.
Once VMs are up and running I run a test on Windows which take like 1 hour, and if run successfully I move on to Linux
and run anther test. Total time of the test are around 2 hours.
Each test is define as a different task under different group as Windows use WINRM and Linux use SSH.

I was thinking to run both test on the same time, which means I should have one task run on the the same group via hosts = <name_of_the_group>.
However I can’t find how to define a condition where the parameters of the connection will be different, so ansible will use SSH for Linux and WINRM for Windows.

I looked here :

http://docs.ansible.com/intro_inventory.html#hosts-and-groups &

https://github.com/GoogleCloudPlatform/stackdriver-ansible-role/blob/master/tasks/main.yml &

https://docs.ansible.com/playbooks_conditionals.html#conditional-imports

And was trying to load {{ansible_os_family}}.yml so Windows will take the following:

ansible_connection: winrm
ansible_ssh_user: Administrator
ansible_ssh_pass: **********
ansible_ssh_port: 5985

However Ansible always use SSH -( !

Maybe I should consider working with Asynchronous Actions and Polling? https://docs.ansible.com/playbooks_async.html

I give it a try - but this also was not working as expected.

Maybe someone have any alternative idea?

Thanks

Sassy

try creating a group_vars/windows and put the settings in there, then
make sure the windows machines belong to the 'windows' group.