
In this post, I will show you how to create a directory on a CIFS shared folder hosted on the Windows machine
This task can be achieved by configuring the WinRM listener on the Windows machine. In the playbook, we will communicate with the listener using CredSSP. The TCP port is defined on 5986 (WinRM default port for HTTPS listener)
You can find here a documentation on how to configure this WinRM listener
--- - hosts: myWindowsNode vars: ansible_user: mywinusername ansible_password: Password ansible_port: 5986 ansible_connection: winrm ansible_winrm_transport: credssp ansible_winrm_server_cert_validation: validate tasks: - name: create the folder called "TheNewFolder" win_file: path: "//myFileSEerver01/MySharedFolder/TheNewFolder" state: directory
Ansible – Create a new directory on a CIFS shared folder
i facing error while running this module.
can you please help.
ERROR :
« module_stderr »: « An error occurred while creating the pipeline.\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordE \r\n xception\r\n + FullyQualifiedErrorId : RuntimeException\r\n \r\nException calling \ »Run\ » with \ »1\ » argument(s): \ »Exception calling \ »Invoke\ » with \r\n\ »0\ » argument(s): \ »The running command stopped because the preference variable \r\n\ »ErrorActionPreference\ » or common parameter is set to Stop: Access is denied\ »\ »\r\nAt line:47 char:5\r\n+ $output = $entrypoint.Run($payload)\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordE \r\n xception\r\n + FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n \r\n », « module_stdout »: « », « msg »: « MODULE FAILURE », « rc »: 1}
Hello Saradhi, you have an access denied error. You have to check if the ansible user you use, have the correct permissions to create the folder.
i facing error while running this module.
can you please help.
ERROR :
« module_stderr »: « An error occurred while creating the pipeline.\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordE \r\n xception\r\n + FullyQualifiedErrorId : RuntimeException\r\n \r\nException calling \ »Run\ » with \ »1\ » argument(s): \ »Exception calling \ »Invoke\ » with \r\n\ »0\ » argument(s): \ »The running command stopped because the preference variable \r\n\ »ErrorActionPreference\ » or common parameter is set to Stop: Access is denied\ »\ »\r\nAt line:47 char:5\r\n+ $output = $entrypoint.Run($payload)\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordE \r\n xception\r\n + FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n \r\n », « module_stdout »: « », « msg »: « MODULE FAILURE », « rc »: 1}
Hello Saradhi, you have an access denied error. You have to check if the ansible user you use, have the correct permissions to create the folder.