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

**URL:** <https://forum.ansible.com/t/hosts-all-one-simple-task-but-for-multi-platform-windows-winrm-ssh/18423>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 7, 2015, 1:09pm UTC](https://forum.ansible.com/t/hosts-all-one-simple-task-but-for-multi-platform-windows-winrm-ssh/18423 "2015-06-07T13:09:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sassy\_Natan](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@Sassy\_Natan](https://forum.ansible.com/u/Sassy_Natan)\
**Post date:** [June 7, 2015, 1:09pm UTC](https://forum.ansible.com/t/hosts-all-one-simple-task-but-for-multi-platform-windows-winrm-ssh/18423/1 "2015-06-07T13:09:50Z")

</div>

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](http://docs.ansible.com/intro_inventory.html#hosts-and-groups) &

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

[https://docs.ansible.com/playbooks\_conditionals.html#conditional-imports](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](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

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 7, 2015, 9:36pm UTC](https://forum.ansible.com/t/hosts-all-one-simple-task-but-for-multi-platform-windows-winrm-ssh/18423/2 "2015-06-07T21:36:16Z")

</div>

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