Can you try the one below?
---
- hosts: all
tasks:
- name: Create Directory if not exist
win_file:
path: c:\temp
state: directory
On Tue, Jun 22, 2021 at 7:08 AM [email protected] <[email protected]> wrote:
> 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
>
>
> On Sunday, June 28, 2020 at 11:15:45 PM UTC-4 [email protected] wrote:
>
>> 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
>> <https://docs.ansible.com/ansible/latest/modules/win_file_module.html#examples>
>> its Temp, not temp.
>>
>> On Sun, Jun 28, 2020 at 11:59 PM Tony Wong <[email protected]> wrote:
>>
>>> is it the Capital C?
>>>
>>> just tied and same error
>>>
>>> On Sun, Jun 28, 2020 at 11:03 AM Tej Singh Rana <[email protected]>
>>> wrote:
>>>
>>>> You have to use --> path: C:\temp
>>>>
>>>> On Sun, Jun 28, 2020 at 11:20 PM Tony Wong <[email protected]> wrote:
>>>>
>>>>> ---
>>>>> - 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?
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/CALmkhkpu7K4k0u27d3kXtNtAziRfXztXKM8e%3DggoqwhaShCtuw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/ansible-project/CALmkhkpu7K4k0u27d3kXtNtAziRfXztXKM8e%3DggoqwhaShCtuw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/CADBoQTrs%3DQDJfYNhUaxgc%3D3SfGktW07qTWCRguYEr5UFemDV4w%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/ansible-project/CADBoQTrs%3DQDJfYNhUaxgc%3D3SfGktW07qTWCRguYEr5UFemDV4w%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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 [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CALmkhkrHp2B%2BgytHxQv7EZjzcU7P8vubzxRWxZw9vOq182jXLg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CALmkhkrHp2B%2BgytHxQv7EZjzcU7P8vubzxRWxZw9vOq182jXLg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f83f511a-8452-46f0-bce6-ac8ff1933d18n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f83f511a-8452-46f0-bce6-ac8ff1933d18n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAK8vF9KDJrPqnB_XyXxq3Re4gFCmELYnwG2uunG4Uo1BiGe%3DeA%40mail.gmail.com.