# cannot get win\_template to work

**URL:** <https://forum.ansible.com/t/cannot-get-win-template-to-work/18328>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 28, 2015, 7:37am UTC](https://forum.ansible.com/t/cannot-get-win-template-to-work/18328 "2015-05-28T07:37:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake\_Dupuy](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jake\_Dupuy](https://forum.ansible.com/u/Jake_Dupuy)\
**Post date:** [May 28, 2015, 7:37am UTC](https://forum.ansible.com/t/cannot-get-win-template-to-work/18328/1 "2015-05-28T07:37:41Z")

</div>

someone please help me out. I cannot get win\_template or win\_copy to work. I’m able to do a simple ipconfig test to confirm that ansible is working with windows I’ve got some powershell scripts that I need to have in a template with vars so I can put them on the windows box and run them. I’ve got a roles structure setup

when I do this\>\>

- name: check file dir  
win\_stat: path=C:\temp  
register: win\_test

- name: debug  
debug: var=win\_test

> > > output of the debug

ok: [172.16.0.81] =\> {  
“var”: {  
“win\_test”: {  
“changed”: false,  
“invocation”: {  
“module\_args”: “path=C:\temp”,  
“module\_name”: “win\_stat”  
},  
“stat”: {  
“exists”: true,  
“isdir”: true  
}  
}  
}  
}

> > >

- name: copy template  
win\_template: dest=C:\temp src=“{{ template\_ps1 }}”

> > > but when I try and use the win\_template I get:  
> > > “ERROR: win\_template is not a legal parameter in an Ansible task or handler”

---

<div class="post-metadata">

**Author:** ![benno\_joy](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@benno\_joy](https://forum.ansible.com/u/benno_joy)\
**Post date:** [May 28, 2015, 12:12pm UTC](https://forum.ansible.com/t/cannot-get-win-template-to-work/18328/2 "2015-05-28T12:12:12Z")

</div>

Hi Jake,

Seems like the win\_template module was readded 6 days back , are you testing this in the latest devel branch ?

- Benno

---

<div class="post-metadata">

**Author:** ![Jake\_Dupuy](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jake\_Dupuy](https://forum.ansible.com/u/Jake_Dupuy)\
**Post date:** [May 28, 2015, 5:46pm UTC](https://forum.ansible.com/t/cannot-get-win-template-to-work/18328/3 "2015-05-28T17:46:13Z")

</div>

Thanks for the reply, I’ve got a work around but do need to figure out what was going wrong:

- name: create script locally  
local\_action: template dest=“{{ my\_dest }}” src=“{{ my\_template }}”

- name: run ps script on remote  
script: “{{ my\_ps\_script }}”

---

<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:** [May 29, 2015, 12:37pm UTC](https://forum.ansible.com/t/cannot-get-win-template-to-work/18328/4 "2015-05-29T12:37:22Z")

</div>

Which ansible version are you using?

1.9.1 contains the action plugin for win\_template, but needs win\_file and win\_copy modules to work, which weren’t included in that release.

I just pushed a couple of PRs to improve win\_copy / win\_file / win\_template and would be grateful for any feedback if you could test.

PRs are:

[ansible/ansible#11086](https://github.com/ansible/ansible/pull/11086)  
and  
[#1438](https://github.com/ansible/ansible-modules-core/pull/1438)

Jon
