[ansible-project] Execut script with Ansible

2020-01-28 Thread Karther
Hello, I have one script python script.py with this content : *#!/usr/bin/python* *import pymssql* *conn = pymssql.connect(host="ihospisql02", user="sa_ofs", password="#Adm!n0fS1", database="my_database")* *cur = conn.cursor()* *with open('real.sql') as f:* *cur.execute(f.read().decode('u

Re: [ansible-project] Execut script with Ansible

2020-01-28 Thread P. Varsha
can you please share what actually error log you are getting. On Tue, Jan 28, 2020 at 4:13 PM Karther wrote: > Hello, > > I have one script python script.py with this content : > > *#!/usr/bin/python* > > *import pymssql* > > *conn = pymssql.connect(host="ihospisql02", user="sa_ofs", > password=

Re: [ansible-project] Execut script with Ansible

2020-01-28 Thread Karther
Hello Varsha, For exemple if in my script sql "real.sql" there is commande line toto I have this error : Traceback (most recent call last): File "./script_sql_4.py", line 19, in cur.execute(f.read().decode('utf-8')) File "/usr/lib/pymodules/python2.7/pymssql.py", line 196, in execute

Re: [ansible-project] Execut script with Ansible

2020-01-28 Thread Stefan Hornburg (Racke)
On 1/28/20 5:13 PM, Karther wrote: > Hello Varsha, > > For exemple if in my script sql "real.sql" there is commande line toto > I have this error : > > Traceback (most recent call last): >   File "./script_sql_4.py", line 19, in >     cur.execute(f.read().decode('utf-8')) >   File "/usr/lib/pymo

Re: [ansible-project] Execut script with Ansible

2020-01-29 Thread Karther
Hello, Yes my task is this : - name: "Execut script python" shell: ./myscript.py delegate_to: localhost I want to get statut of my command line in my script for get message error. Thanks very much Community Ansible :) Best Regards, Karther Le mardi 28 janvier 2020 17:54:58 UTC+1, Stefan

Re: [ansible-project] Execut script with Ansible

2020-01-29 Thread Stefan Hornburg (Racke)
On 1/29/20 9:22 AM, Karther wrote: > Hello, > > Yes my task is this : > > - name: "Execut script python" >   shell: ./myscript.py >   delegate_to: localhost > > I want to get statut of my command line in my script for get message error. Please try this (untested): - name: "Execut script python

Re: [ansible-project] Execut script with Ansible

2020-01-29 Thread Karther
Hello, Yes this register variable error works but i want to get status of execution of my python programme *cur.execute* : I want to know from this programme python if *cur.execute* is success execute or not ... *#!/usr/bin/python* *import pymssql* *conn = pymssql.connect(host="ihospisql02",

Re: [ansible-project] Execut script with Ansible

2020-01-29 Thread Stefan Hornburg (Racke)
On 1/29/20 10:49 AM, Karther wrote: > Hello, > > Yes this register variable error works but i want to get status of execution > of my python programme *cur.execute* : > I want to know from this programme python if *cur.execute* is success execute > or not ... > That's up to your script, really