Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.mssql_db.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| autocommit boolean |
| 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. |
| login_host string | Host running the database | |
| login_password string | The password used to authenticate with | |
| login_port string | Default: 1433 | Port of the MSSQL server. Requires login_host be defined as other than localhost if login_port is used |
| login_user string | The username used to authenticate with | |
| name string / required | name of the database to add or remove aliases: db | |
| state string |
| The database state |
| target string | Location, on the remote host, of the dump file to read from or write to. Uncompressed SQL files ( .sql) files are supported. |
Note
- 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
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/mssql_db_module.html