# Ansible win\_file can not create a directory on a partitioned drive?

**URL:** <https://forum.ansible.com/t/ansible-win-file-can-not-create-a-directory-on-a-partitioned-drive/35388>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [June 22, 2021, 1:35am UTC](https://forum.ansible.com/t/ansible-win-file-can-not-create-a-directory-on-a-partitioned-drive/35388 "2021-06-22T01:35:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [June 22, 2021, 1:35am UTC](https://forum.ansible.com/t/ansible-win-file-can-not-create-a-directory-on-a-partitioned-drive/35388/1 "2021-06-22T01:35:04Z")

</div>

Ansible 2.11.0

I created an I: disk partition on my Windows 2019 host under jenkins user, who is an admin. Logged in as jenkins, I can create a directory on the partition through the GUI.

Now I have this Ansible task that simply tries to create the same directory structure, like this

- name: “Create data directory {{ pg\_data\_dir }}”  
win\_file:  
path: “{{ pg\_data\_dir }}” # I:\pgdata\13  
status: directory

I get …

TASK [postgresql : Create data directory I:\pgdata\13] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /path/ansible/exa-playbooks/roles/postgresql/tasks/install\_postgresql.yml:21  
redirecting (type: modules) ansible.builtin.win\_file to ansible.windows.win\_file  
Using module file /usr/local/Cellar/ansible/3.3.0/libexec/lib/python3.9/site-packages/ansible\_collections/ansible/windows/plugins/modules/win\_file.ps1  
Pipelining is enabled.  
\<10.227.xx.xx\> ESTABLISH WINRM CONNECTION FOR USER: jenkins on PORT 5986 TO 10.227.xx.xx  
EXEC (via pipeline wrapper)  
fatal: [10.227.xx.xx]: FAILED! =\> {  
“changed”: false,  
“msg”: “path I:\pgdata\13 will not be created”  
}

Any clues?

---

<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 22, 2021, 6:58pm UTC](https://forum.ansible.com/t/ansible-win-file-can-not-create-a-directory-on-a-partitioned-drive/35388/2 "2021-06-22T18:58:34Z")

</div>

You have a typo, it’s ‘state’ not ‘status’. The default value is ‘state: file’ and due to historical behaviour ‘state: file’ will not create the file.

---

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [June 22, 2021, 11:46pm UTC](https://forum.ansible.com/t/ansible-win-file-can-not-create-a-directory-on-a-partitioned-drive/35388/3 "2021-06-22T23:46:03Z")

</div>

Duh on me. Thanks!

Chris
