# Playbook on both Linux and Windows

**URL:** <https://forum.ansible.com/t/playbook-on-both-linux-and-windows/29061>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [November 19, 2018, 8:06am UTC](https://forum.ansible.com/t/playbook-on-both-linux-and-windows/29061 "2018-11-19T08:06:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.hand](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@daniel.hand](https://forum.ansible.com/u/daniel.hand)\
**Post date:** [November 19, 2018, 8:06am UTC](https://forum.ansible.com/t/playbook-on-both-linux-and-windows/29061/1 "2018-11-19T08:06:20Z")

</div>

Hey!

I’m attempting to add a Windows element to one of my Linux playbooks.

They’re both separate roles at the moment. The Linux one has hosts set to localhost, but the Windows part needs to be delegated elsewhere, AND keeping variables from the Linux part.

I’ve attended to add Windows commands with delegate to my Linux playbook, but no dice. I’m getting a port 22 refused. For reference here’s my playbook:

`

---

<div class="post-metadata">

**Author:** ![rhysmeister](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rhysmeister/32/10599_2.png) [@rhysmeister](https://forum.ansible.com/u/rhysmeister)\
**Post date:** [November 19, 2018, 10:07am UTC](https://forum.ansible.com/t/playbook-on-both-linux-and-windows/29061/2 "2018-11-19T10:07:07Z")

</div>

How you’re doing it would seem to be the obvious way to me but you’ll need to change the connection first…

"In order to connect to your Windows hosts properly, you need to make sure that you put in `ansible_connection=winrm` in the [host vars](http://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#host-variables)section of your inventory file so that Ansible Engine doesn’t just keep trying to connect to your Windows host via SSH. "

[https://www.ansible.com/blog/connecting-to-a-windows-host](https://www.ansible.com/blog/connecting-to-a-windows-host)
