# Running local play with winrm config

**URL:** <https://forum.ansible.com/t/running-local-play-with-winrm-config/21791>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 16, 2016, 11:19am UTC](https://forum.ansible.com/t/running-local-play-with-winrm-config/21791 "2016-06-16T11:19:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [June 16, 2016, 11:19am UTC](https://forum.ansible.com/t/running-local-play-with-winrm-config/21791/1 "2016-06-16T11:19:48Z")

</div>

Hi

I am having issues trying to create a play that will setup a Windows EC2 instance and then install software once it is up. For linux instances I do the following to create a new instance on the localhost and then run the other roles on the new instance once it is ready.

`

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 16, 2016, 2:29pm UTC](https://forum.ansible.com/t/running-local-play-with-winrm-config/21791/2 "2016-06-16T14:29:45Z")

</div>

I think you should set up your inventory in a manner similar to what is described in the windows introduction.

[http://docs.ansible.com/ansible/intro\_windows.html#inventory](http://docs.ansible.com/ansible/intro_windows.html#inventory)

put the windows-specific connection vars into a group and then when you want to do things to a windows host, use the windows group name for the hosts: line in your play.

By doing

vars\_files:

- group\_vars/tag\_Application\_alfred-linux.yml
- group\_vars/tag\_Environment\_dev.yml

you are forcing the vars in the group\_vars folder to apply to all hosts.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [June 16, 2016, 2:37pm UTC](https://forum.ansible.com/t/running-local-play-with-winrm-config/21791/3 "2016-06-16T14:37:34Z")

</div>

Thanks for the suggestion, the trouble I am having is that I want to create the instance from ec2 and all my hosts are gotten dynamically. Are you suggesting I split up my config so the aws variables are in one file and then my tagged application details are in another which contains the connection details. Is there a better way to do it as I feel like maintaining multiple config files can get difficult as it grows in the future.

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 17, 2016, 1:41pm UTC](https://forum.ansible.com/t/running-local-play-with-winrm-config/21791/4 "2016-06-17T13:41:20Z")

</div>

Sounds like my ansible setup is rather different from yours, but I have wound up with a handful of config files for each environment - ones that configure connections to hosts I always keep separate from ‘business’ type vars.

I don’t know if using the add\_host module [http://docs.ansible.com/ansible/add\_host\_module.html](http://docs.ansible.com/ansible/add_host_module.html) might help you to create a bunch of windows hosts, then add them to a windows group so they get the right vars when you try to connect to them.

Hope this helps

Jon
