how to run the python script from ansible to Windows 2019?

hi Team ,

i am getting error while run the python script from ansible to windows 2019. kindly help me to fix the issue

error :

“Traceback (most recent call last):”,
" File "deploy.py", line 866, in “,
" DatabaseCreator().main()”,
" File "deploy.py", line 788, in main",
" os.makedirs(self.ECRF_FGDB_PATH)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedirs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedirs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedirs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 157, in makedirs”,
" mkdir(name, mode)",
“WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: ‘\\\\’”

To answer your question more information is needed. Could you please
describe clearly all of the below:

- What goal you are trying to achieve.
- How you are doing this.
- What problems you encounter.
- Which commands did you run, and what actual output did you get
(copied as plain text - not as screenshots, images, or other binary
attachments).
- What do the relevant inventory/tasks/playbooks/code/variables look like.
- The output of ‘ansible --version’

hi

  • What goal you are trying to achieve
    I need to run the python script on windows machine by ansible
  • How you are doing this.
    i have python script on windows machine then i write the bat file for run the python script , python installed on "F:\Python27\ArcGISx6410.7\python.exe .
    my bat file is cd “F:\scc_install_dir\EGDMSDatabaseDeploy”
    “F:\Python27\ArcGISx6410.7\python.exe” “EGDMSDatabaseDeploy.py”
    exit
    EGDMSDatabaseDeploy.py is the python script name

Cmd and error

fatal: [10.105.83.32]: FAILED! => {
“changed”: true,
“cmd”: “db.bat”,
“delta”: “0:00:13.881565”,
“end”: “2020-05-08 11:32:14.295884”,
“msg”: “non-zero return code”,
“rc”: 1,
“start”: “2020-05-08 11:32:00.414319”,
“stderr”: “The filename, directory name, or volume label syntax is incorrect .\r\nTraceback (most recent call last):\r\n File "F:\FileShare\FTPRoot\Chid ambaram_Files\DBDeploy\EGDMSDatabaseDeploy_v3_4_14.py", line 874, in \r\n DatabaseCreator().main()\r\n File "F:\FileShare\FTPRoot\Chidambaram _Files\DBDeploy\EGDMSDatabaseDeploy_v3_4_14.py", line 788, in main\r\n os. makedirs(self.ECRF_FGDB_PATH)\r\n File "F:\Python27\ArcGISx6410.7\lib\os.p y", line 150, in makedirs\r\n makedirs(head, mode)\r\n File "F:\Python27\ \ArcGISx6410.7\lib\os.py", line 150, in makedirs\r\n makedirs(head, mode)\ r\n File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedirs\r\n makedirs(head, mode)\r\n File "F:\Python27\ArcGISx6410.7\lib\os.py", line 157, in makedirs\r\n mkdir(name, mode)\r\nWindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: ‘\\\\’\r\n”,
“stderr_lines”: [
“The filename, directory name, or volume label syntax is incorrect.”,
“Traceback (most recent call last):”,
" File "F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy\EGDMSData baseDeploy_v3_4_14.py", line 874, in “,
" DatabaseCreator().main()”,
" File "F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy\EGDMSData baseDeploy_v3_4_14.py", line 788, in main",
" os.makedirs(self.ECRF_FGDB_PATH)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedi rs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedi rs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 150, in makedi rs”,
" makedirs(head, mode)“,
" File "F:\Python27\ArcGISx6410.7\lib\os.py", line 157, in makedi rs”,
" mkdir(name, mode)",
“WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: ‘\\\\’”
],
“stdout”: “\r\nF:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy>##"F:\F ileShare\FTPRoot\Chidambaram_Files\DBDeploy"\r\n\r\nF:\FileShare\FTPRoot\ Chidambaram_Files\DBDeploy>"F:\Python27\ArcGISx6410.7\python.exe" "F:\Fi leShare\FTPRoot\Chidambaram_Files\DBDeploy\EGDMSDatabaseDeploy_v3_4_14.py" \r\n****************************************************\r\n*** EGDMS v2.0 DATAB ASE DEPLOYMENT PROCESS \r\n***************************************** ********\r\n\r\nReading configuration settings…\r\n\r\nF:\FileShare\FTPRoot\ \Chidambaram_Files\DBDeploy>exit\r\n”,
“stdout_lines”: [
“”,
“F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy>##"F:\FileShare\ FTPRoot\Chidambaram_Files\DBDeploy"”,
“”,
"F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy>"F:\Python27\Arc GISx6410.7\python.exe" "F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy\ EGDMSDatabaseDeploy_v3_4_14.py" ",
",
"
EGDMS v2.0 DATABASE DEPLOYMENT PROCESS ",
"
”,
“”,
“Reading configuration settings…”,
“”,
“F:\FileShare\FTPRoot\Chidambaram_Files\DBDeploy>exit”
]
}

-Ansible version

ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/dgunasin/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

i am getting result when i run the bat file manually on windows machine ,

You forgot the most important information ^^^

hi ,anyone have idea ?

Hi any suggestions plz

hi ,anyone have idea ?