lowlydba.sqlserver.nonquery module – Executes a generic nonquery

Note

This module is part of the lowlydba.sqlserver collection (version 3.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install lowlydba.sqlserver. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: lowlydba.sqlserver.nonquery.

New in lowlydba.sqlserver 0.1.0

Synopsis

  • Execute a nonquery against a database. Does not return a resultset. Ideal for ad-hoc configurations or DML queries.

  • The statement is executed as supplied and is not idempotent; the module always reports changed when it runs. Guard it with a when condition or a preceding check if repeat runs must be no-ops.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter

Comments

database

string / required

Name of the database to execute the nonquery in.

nonquery

string / required

The nonquery to be executed.

query_timeout

integer

Number of seconds to wait before timing out the nonquery execution.

Default: 60

sql_instance

string / required

The SQL Server instance to modify.

sql_password

string

Password for SQL Authentication.

sql_username

string

Username for SQL Authentication.

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

platform

Platforms: all

Target OS/families that can be operated against.

Examples

- name: Update active users
  lowlydba.sqlserver.nonquery:
    sql_instance: sql01.example.com
    database: AppDb
    nonquery: "UPDATE dbo.Users SET IsActive = 1;"

Authors

  • John McCall (@lowlydba)