dpredhat / ansible-role-mssql

A role for deploying, configuring, and removing Microsoft SQL Server 2019 on RHEL 8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Role Name

This role will perform the following:

  • Install and uninstall of the Microsoft SQL Server
  • Create, delete, or import (from .sql file) a database
  • Optional command line tools for RHEL 8

Requirements

In order for this role to work, you need some core repositories configured for your RHEL instance. If running this in a public cloud provider, this has likely already been done for you. If necessary, register the system to Red Hat's content repositories or Red Hat Satellite using subscription-manager.

Role Variables

The only variables in Defaults are around the mssql packages and should not need to be changed. Pip is also included in order to handle the expect module for accepting the EULA.

Within Vars, you must explicitly agree to the End User's License Agreement for both the server setup script and the command line tools. To do this, add Y or YES where applicable to the variables for each EULA.

The default user is 'SA' when logging in via command line tools. The SA user is mandatory for initial creation, this role does not currently offer the ability to create additional users.

Additionally, there are some predefined default values including:

# These are required for database installation
end_user_license_aggreement_consent_server: Y # Must be Y or N
end_user_license_aggreement_consent_cli: "YES" # Must be YES or NO in all caps within quotes
edition: evaluation

# For use when creating, importing, or deleting databases
db_name: testDB
db_host: 127.0.0.1
db_port: 1433
db_user: sa

I would strongly recommend modifying these for anything beyond a basic proof of concept.

Probably the bast way to approach this is to copy these values to an extra vars file and including it in your playbook or by running them from the command line like so: ansible-playbook site.yml -e @extra_vars.yml

Dependencies

No additional galaxy roles are required.

Example Playbook

To use the default installation tasks:

- hosts: db
  roles:
     - { role: dpredhat.mssql }

To use the installation and create a new db, I usually give the service a few seconds to come up before attempting to login:

---
- hosts: db
  become: yes
  roles:
    - { role: dpredhat.mssql }
  tasks:
    - name: Wait up to 60 seconds for server to become available after creation
      wait_for:
        port: 1433
        timeout: 60
    - name: Create new db
      include_role:
        name: dpredhat.mssql
        tasks_from: new_db

To use the uninstall tasks:

---
- hosts: db
  name: Removes mssql-server
  become: yes

  tasks:
  - name: Run remove tasks from mssql-server role
    include_role:
      name: dpredhat.mssql
      tasks_from: uninstall

License

BSD

Author Information

Contributions and issues with this role are welcome at the associated git repo. This code was inspired and derived based on kyleabenson

About

A role for deploying, configuring, and removing Microsoft SQL Server 2019 on RHEL 8