Hi all,
I want know if Ansible can execut commands SQL for Microsoft SQL Server ?
I think that possible with command powershell but what is syntax ansible ?
for exemple, i want create table on my SQL Server (CREATE DATABASE ma_base) with Ansible…
What is a procedure ? I know there is win_shell and then … ?
Thank you very much community ansible !!
Regards,
im used win_command whit SQLCMD
Ejm:
-
name: Copia Script DBA
win_copy:
src: script_dbaGenerico.sql
dest: “{{ servers_setup_dir }}\script_dbaGenerico.sql”
-
name: exec createDBA
win_command: “sqlcmd -U sa -P {{ mssql_sa_pwd }} -S {{ ansible_hostname }} -i script_dbaGenerico.sql”
args:
chdir: “{{ servers_setup_dir }}”
-
name: Borra archivos instaladores
win_file:
path: “{{ item }}”
state: absent
with_items:
-
“{{ servers_setup_dir }}\ConfigurationFile.ini”
-
“{{ servers_setup_dir }}\script_dbaGenerico.sql”
Hi andres,
Okey !! Thank you very much for your answer !!
I will try this isue quickly !!
Thanks,
Regards