lowlydba.sqlserver.install_script (2.3.2) — module

Runs migration scripts against a database

| "added in version" 0.11.0 of lowlydba.sqlserver"

Authors: John McCall (@lowlydba)

Install collection

Install with ansible-galaxy collection install lowlydba.sqlserver:==2.3.2


Add to requirements.yml

  collections:
    - name: lowlydba.sqlserver
      version: 2.3.2

Description

Uses the module C(DBOps) to run C(Dbo-InstallScript) against a target SQL Server database.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Migrate a database
  lowlydba.sqlserver.install_script:
    sql_instance: test-server.my.company.com
    database: AdventureWorks
    path: migrations

Inputs

    
path:
    description:
    - Directory where targeted sql scripts are stored.
    required: true
    type: str

match:
    description:
    - Runs a regex verification against provided file names using the provided string.
    required: false
    type: str

database:
    description:
    - Name of the target database.
    required: true
    type: str

no_recurse:
    default: false
    description:
    - Only process the first level of the target path.
    required: false
    type: bool

output_file:
    description:
    - Log output into specified file.
    required: false
    type: str

sql_instance:
    description:
    - The SQL Server instance to modify.
    required: true
    type: str

sql_password:
    description:
    - Password for SQL Authentication.
    required: false
    type: str

sql_username:
    description:
    - Username for SQL Authentication.
    required: false
    type: str

no_log_version:
    default: false
    description:
    - If set, the deployment will not be tracked in the database. That will also mean
      that all the scripts and all the builds from the package are going to be deployed
      regardless of any previous deployment history.
    required: false
    type: bool

create_database:
    default: false
    description:
    - Will create an empty database if missing.
    required: false
    type: bool

deployment_method:
    choices:
    - NoTransaction
    - SingleTransaction
    - TransactionPerScript
    - AlwaysRollback
    default: NoTransaction
    description:
    - C(SingleTransaction) - wrap all the deployment scripts into a single transaction
      and rollback whole deployment on error.
    - C(TransactionPerScript) - wrap each script into a separate transaction; rollback
      single script deployment in case of error.
    - C(NoTransaction) - deploy as is.
    - C(AlwaysRollback) - roll back the transaction.
    required: false
    type: str

execution_timeout:
    default: 0
    description:
    - Script execution timeout. The script will be aborted if the execution takes more
      than specified number of seconds.
    required: false
    type: int

connection_timeout:
    default: 30
    description:
    - Database server connection timeout in seconds. Only affects connection attempts.
      Does not affect execution timeout.
    required: false
    type: int

schema_version_table:
    description:
    - A table that will hold the history of script execution. This table is used to choose
      what scripts are going to be run during the deployment, preventing the scripts from
      being execured twice.
    required: false
    type: str

Outputs

data:
  description: Modified output from the C(Install-DboScript) function.
  returned: success, but not in check_mode.
  type: dict