# Ansible windows issue about running yml task

**URL:** <https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [March 14, 2018, 11:35am UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994 "2018-03-14T11:35:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![selim\_sarisu](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@selim\_sarisu](https://forum.ansible.com/u/selim_sarisu)\
**Post date:** [March 14, 2018, 11:35am UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994/1 "2018-03-14T11:35:40Z")

</div>

Hi Friends ,

When I tried to run any .yml task on the Ansible , I get following error ;

My Syntax is here ,

```auto
- name: Create directory structure
  win_file:
    path: C:\Temp\folder\subfolder
    state: directory

```

```auto

```

ERROR! ‘win\_file’ is not a valid attribute for a Play

The error appears to have been in ‘/etc/ansible/create.yml’: line 1, column 3, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Create directory structure  
^ here

Any ideal ?

---

<div class="post-metadata">

**Author:** ![lpescatore](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@lpescatore](https://forum.ansible.com/u/lpescatore)\
**Post date:** [March 14, 2018, 4:43pm UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994/2 "2018-03-14T16:43:31Z")

</div>

You don’t have whitespace right, which Ansible is very finicky about.  
Try:

- name: Create directory structure  
win\_file:  
path: C:\Temp\folder\subfolder  
state: directory

Don’t use “tab” keys, use your space bar.

HTH,  
Larry

---

<div class="post-metadata">

**Author:** ![lpescatore](https://avatars.discourse-cdn.com/v4/letter/l/ccd318/32.png) [@lpescatore](https://forum.ansible.com/u/lpescatore)\
**Post date:** [March 14, 2018, 4:45pm UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994/3 "2018-03-14T16:45:34Z")

</div>

This is one of my plays.

- name: Make Tools folder

win\_file:

path: C:\Tools

state: directory

- name: Make build folder

win\_file:

path: C:\build

state: directory

- name: Make TEMP folder

win\_file:

path: C:\TEMP

state: directory

- name: Make log folder inside of temp

win\_file:

path: C:\TEMP\log

state: directory

---

<div class="post-metadata">

**Author:** ![Tchia04](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@Tchia04](https://forum.ansible.com/u/Tchia04)\
**Post date:** [March 14, 2018, 4:45pm UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994/4 "2018-03-14T16:45:44Z")

</div>

do you have “tasks:” defined before your win\_file?

try this

- hosts: all  
tasks:
- name: Create directory structure  
win\_file:  
path: C:\Temp\folder\subfolder  
state: directory

---

<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:** [March 14, 2018, 8:38pm UTC](https://forum.ansible.com/t/ansible-windows-issue-about-running-yml-task/26994/5 "2018-03-14T20:38:17Z")

</div>

Yep, the post above is your problem, you are trying to run a list of tasks under ansible-playbook when you need to structure it like a play. When referring to roles you can just have the tasks but the root playbook must include things like hosts, tasks, roles and so on as the root keys.

Thanks

Jordan
