community / community.general / 1.3.14 / module / odbc Execute SQL via ODBC | "added in version" 1.0.0 of community.general" Authors: John Westcott IV (@john-westcott-iv)community.general.odbc (1.3.14) — module
Install with ansible-galaxy collection install community.general:==1.3.14
collections: - name: community.general version: 1.3.14
Read/Write info via ODBC drivers.
- 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
dsn: description: - The connection string passed into ODBC. required: true type: str query: description: - The SQL query to perform. required: true type: str commit: default: true description: - Perform a commit after the execution of the SQL query. - Some databases allow a commit after a select whereas others raise an exception. - Default is C(true) to support legacy module behavior. type: bool version_added: 1.3.0 version_added_collection: community.general params: description: - Parameters to pass to the SQL query. elements: str type: list
description: description: List of dicts about the columns selected from the cursors, likely empty for DDL statements. See notes. elements: dict returned: success type: list results: description: List of lists of strings containing selected rows, likely empty for DDL statements. elements: list returned: success type: list row_count: description: The number of rows selected or modified according to the cursor defaults to -1. See notes. returned: success type: str