community.general.mssql_db – Add or remove MSSQL databases from a remote host.¶
Note
This plugin is part of the community.general collection (version 1.3.6).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.mssql_db
.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
pymssql
Parameters¶
Notes¶
Note
Requires the pymssql Python package on the remote host. For Ubuntu, this is as easy as pip install pymssql (See ansible.builtin.pip.)
Examples¶
- 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
Authors¶
Vedit Firat Arig (@vedit)