community / community.general / 8.5.0 / module / mssql_db Add or remove MSSQL databases from a remote host Authors: Vedit Firat Arig (@vedit)community.general.mssql_db (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Add or remove MSSQL databases from a remote host.
- name: Create a new database with name 'jackdata' community.general.mssql_db: name: jackdata state: present
# Copy database dump file to remote host and restore it to database 'my_db' - name: Copy database dump file to remote host ansible.builtin.copy: src: dump.sql dest: /tmp
- name: Restore the dump file to database 'my_db' community.general.mssql_db: name: my_db state: import target: /tmp/dump.sql
name: aliases: - db description: - name of the database to add or remove required: true type: str state: choices: - present - absent - import default: present description: - The database state type: str 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. type: str autocommit: default: false 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 required: true type: str login_port: default: '1433' description: - Port of the MSSQL server. Requires login_host be defined as other than localhost if login_port is used type: str login_user: default: '' description: - The username used to authenticate with type: str login_password: default: '' description: - The password used to authenticate with type: str