community.general.odbc – Execute SQL via ODBC¶
Note
This plugin is part of the community.general collection (version 1.3.6).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.odbc
.
New in version 1.0.0: of community.general
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
pyodbc
Parameters¶
Notes¶
Note
Like the command module, this module always returns changed = yes whether or not the query would change the database.
To alter this behavior you can use
changed_when
: [yes or no].For details about return values (description and row_count) see https://github.com/mkleehammer/pyodbc/wiki/Cursor.
Examples¶
- name: Set some values in the test db
community.general.odbc:
dsn: "DRIVER={ODBC Driver 13 for SQL Server};Server=db.ansible.com;Database=my_db;UID=admin;PWD=password;"
query: "Select * from table_a where column1 = ?"
params:
- "value1"
commit: false
changed_when: no
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
John Westcott IV (@john-westcott-iv)