error creating a directory

61 views
Skip to first unread message

Tony Wong

unread,
Jun 28, 2020, 1:50:17 PM6/28/20
to ansible...@googlegroups.com
---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\temp
        state: directory


TASK [Create Directory if not exist] ******************************************************************************************************************************************************************************
task path: /home/tony/windows/download.yml:5
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_file.ps1
Pipelining is enabled.
<devsp2016> ESTABLISH WINRM CONNECTION FOR USER: adm-tkw@xxxxon PORT 5986 TO devsp2016
EXEC (via pipeline wrapper)
fatal: [devsp2016]: FAILED! => {
    "changed": false,
    "msg": "path c:\\temp is not a directory"


any idea why I cannot create the directory?

Tej Singh Rana

unread,
Jun 28, 2020, 2:03:34 PM6/28/20
to ansible...@googlegroups.com
You have to use --> path: C:\temp

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALmkhkpu7K4k0u27d3kXtNtAziRfXztXKM8e%3DggoqwhaShCtuw%40mail.gmail.com.

Tony Wong

unread,
Jun 28, 2020, 2:29:58 PM6/28/20
to ansible...@googlegroups.com
is it the Capital C?

just tied and same error

OM Nachiketa

unread,
Jun 28, 2020, 11:15:45 PM6/28/20
to ansible...@googlegroups.com
Run the playbook with the administrator access or grant required access to "adm-tkw" to create dir under C:\\.


And as per the example on win_file ansible doc its Temp, not temp.

Message has been deleted

zil...@gmail.com

unread,
Jun 21, 2021, 9:38:15 PM6/21/21
to Ansible Project
Try c:\\temp as path, like this

---
- name: testing win_get_url
  hosts: all
  tasks:
    - name: Create Directory if not exist
      win_file:
        path: c:\\temp
        state: directory



Rahul Puli

unread,
Jun 24, 2021, 11:15:39 AM6/24/21
to ansible...@googlegroups.com
Can you try the one below?

---
- hosts: all

  tasks:
  - name: Create Directory if not exist
    win_file:
     path: c:\temp
     state: directory
Reply all
Reply to author
Forward
0 new messages