On this page
mssql_db - Add or remove MSSQL databases from a remote host.
New in version 2.2.
Synopsis
- Add or remove MSSQL databases from a remote host.
 
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.7
 - pymssql
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| autocommit  
        bool
         | 
      
       
  | 
      
        
        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 | 
        
        Host running the database
         | 
     |
| login_password | 
        
        The password used to authenticate with
         | 
     |
| login_port | Default: 
        1433
         | 
      
        
        Port of the MSSQL server. Requires login_host be defined as other then localhost if login_port is used
         | 
     
| login_user | 
        
        The username used to authenticate with
         | 
     |
| name  
        required
         | 
      
        
        name of the database to add or remove
        
       aliases: db  | 
     |
| state | 
       
  | 
      
        
        The database state
         | 
     
| target | 
        
        Location, on the remote host, of the dump file to read from or write to. Uncompressed SQL files ( .sql) files are supported.
        | 
     
Notes
Note
- Requires the pymssql Python package on the remote host. For Ubuntu, this is as easy as pip install pymssql (See pip.)
 
Examples
# Create a new database with name 'jackdata'
- mssql_db:
    name: jackdata
    state: present
# Copy database dump file to remote host and restore it to database 'my_db'
- copy:
    src: dump.sql
    dest: /tmp
- mssql_db:
    name: my_db
    state: import
    target: /tmp/dump.sql
  Status
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author
- Vedit Firat Arig
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/mssql_db_module.html