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.

On Tuesday, June 22, 2021 at 11:35:04 AM UTC+10 zil...@gmail.com wrote:

> 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?
>
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f642acf6-22e6-45ba-9488-ea247b6f4940n%40googlegroups.com.

Reply via email to