ansible.builtin.mssql_db (v2.9.27) — module

Add or remove MSSQL databases from a remote host.

| "added in version" 2.2 of ansible.builtin"

Authors: Vedit Firat Arig (@vedit)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Add or remove MSSQL databases from a remote host.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a new database with name 'jackdata'
- mssql_db:
    name: jackdata
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Copy database dump file to remote host and restore it to database 'my_db'
- copy:
    src: dump.sql
    dest: /tmp
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- mssql_db:
    name: my_db
    state: import
    target: /tmp/dump.sql

Inputs

    
name:
    aliases:
    - db
    description:
    - name of the database to add or remove
    required: true

state:
    choices:
    - present
    - absent
    - import
    default: present
    description:
    - The database state

target:
    description:
    - Location, on the remote host, of the dump file to read from or write to. Uncompressed
      SQL files (C(.sql)) files are supported.

autocommit:
    default: 'no'
    description:
    - Automatically commit the change only if the import succeed. Sometimes it is necessary
      to use autocommit=true, since some content can't be changed within a transaction.
    type: bool

login_host:
    description:
    - Host running the database

login_port:
    default: 1433
    description:
    - Port of the MSSQL server. Requires login_host be defined as other than localhost
      if login_port is used

login_user:
    description:
    - The username used to authenticate with

login_password:
    description:
    - The password used to authenticate with