Git Product home page Git Product logo

ansible-role-mssql's Introduction

THIS ROLE HAS BEEN ARCHIVED AS OF DEC 2023.

Install and configure mssql on your system.

GitHub GitLab Downloads Version
github gitlab downloads Version

This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.

---
- name: Converge
  hosts: all
  become: yes
  gather_facts: yes

  roles:
    - role: robertdebock.mssql

The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: yes
  gather_facts: no

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.core_dependencies
    - role: robertdebock.ca_certificates
    - role: robertdebock.microsoft_repository_keys

Also see a full explanation and example on how to use these roles.

The default values for the variables are set in defaults/main.yml:

---
# defaults file for mssql

# mssql_add_repositories can be used to select if you want the repositories installed by this role.
# See vars/main.yml for the location of the repositories. Can be: yes, true or 1.
mssql_add_repositories: yes

# What version to use, currently either 2017 or 2019.
# `2017` is the only working version now, `2019` lacks the required
# mssql-server-agent package.
mssql_version: "2017"

# Select the version of server and server_agent to install.
mssql_server_version: "14.0.3294.2-27"
mssql_server_agent_version: "14.0.3015.40-1"

# mssql_sa_password contains the password for a system administrator.
# The password must be at least 8 characters long and contain characters from
# three of the following four sets:
# - uppercase letters
# - lowercase letters
# - numbers
# - and symbols
mssql_sa_password: "StR0nGp4ss."

# mssql_pid refers to the product key to use. Either:
# - Evaluation
# - Developer
# - Express
# - Web
# - Standard
# - Enterprise
# - A product key (Format: #####-#####-#####-#####-#####)
mssql_pid: Evaluation

# To enable full text search, set this value to yes.
mssql_fts: no

The following roles are used to prepare a system. You can prepare your system in another way.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab
robertdebock.ca_certificates Build Status GitHub Build Status GitLab
robertdebock.core_dependencies Build Status GitHub Build Status GitLab
robertdebock.microsoft_repository_keys Build Status GitHub Build Status GitLab

This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.

Here is an overview of related roles: dependencies

This role has been tested on these container images:

container tags
Amazon Candidate
EL 7

The minimum version of Ansible required is 2.12, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

If you find issues, please register them in GitHub.

Apache-2.0.

robertdebock

Please consider sponsoring me.

ansible-role-mssql's People

Contributors

kvista-els avatar robert-de-bock avatar robertdebock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ansible-role-mssql's Issues

MSSQL server in a restart loop

Describe the bug
The server is in a restart loop and is unable to find the network (dead network of sorts).

To Reproduce
Steps to reproduce the behavior:

  1. Run this role, after your bootstrap role minimum configuration:
- hosts: db
  vars:
    mssql_sa_password: "password-here"
    mssql_pid: Enterprise
    mssql_fts: no
  1. See error in /var/opt/mssql/log/errorlog*:
2019-04-18 13:25:44.06 spid19s     Error: 26024, Severity: 16, State: 1.
2019-04-18 13:25:44.06 spid19s     Server failed to listen on 'any' <ipv6> 1433. Error: 0x2742. To proceed, notify your system administrator.
2019-04-18 13:25:44.06 spid19s     Error: 17182, Severity: 16, State: 1.
2019-04-18 13:25:44.06 spid19s     TDSSNIClient initialization failed with error 0x2742, status code 0xa. Reason: Unable to initialize the TCP/IP listener. A socket operation encountered a dead network. 
2019-04-18 13:25:44.06 spid19s     Error: 17182, Severity: 16, State: 1.
2019-04-18 13:25:44.06 spid19s     TDSSNIClient initialization failed with error 0x2742, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. A socket operation encountered a dead network. 
2019-04-18 13:25:44.07 spid19s     Error: 17826, Severity: 18, State: 3.
2019-04-18 13:25:44.07 spid19s     Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2019-04-18 13:25:44.07 spid19s     Error: 17120, Severity: 16, State: 1.
2019-04-18 13:25:44.07 spid19s     SQL Server could not spawn FRunCommunicationsManager thread. Check the SQL Server error log and the operating system error log for information about possible related problems.

Expected behavior
The mssql is running and I can login via sqlcmd

Environment

  • Control node OS: OSX/Docker
  • Ansible: ansible 2.7.6
  • Managed node OS: CentOS 7

FTS Setup

I think it would be interesting to give the option to install the FTS engine for SQL Server.

For example we would have a mssql_install_fts or something like this, the only thing needed to execute is to install (Here in CentOS) the mssql-server-fts package.

Suse: Attempting to start the Microsoft SQL Server service failed.

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.4.3.0
  config file = None
  configured module search path = [u'/Users/yf30lg/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /Users/yf30lg/Library/Python/2.7/bin/ansible
  python version = 2.7.14 (default, Feb  6 2018, 20:04:00) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
CONFIGURATION

none

OS / ENVIRONMENT

Control node: Mac OS X
Managed node: opensuse/openSUSE-42.2-x86_64

SUMMARY

The build fails.

STEPS TO REPRODUCE

Checkout code: [email protected]:robertdebock/ansible-role-mssql.git and run:

molecule test --scenario-name vagrant
EXPECTED RESULTS

No errors.

ACTUAL RESULTS
    fatal: [mssql-opensuse-openSUSE-42-2-x86-64]: FAILED! => {"changed": true, "cmd": ["/opt/mssql/bin/mssql-conf", "-n", "setup"], "delta": "0:00:06.302685", "end": "2018-03-08 15:38:11.059826", "msg": "non-zero return code", "rc": 1, "start": "2018-03-08 15:38:04.757141", "stderr": "Job for mssql-server.service failed because start of the service was attempted too often. See \"systemctl status mssql-server.service\" and \"journalctl -xe\" for details.\nTo force a start use \"systemctl reset-failed mssql-server.service\" followed by \"systemctl start mssql-server.service\" again.", "stderr_lines": ["Job for mssql-server.service failed because start of the service was attempted too often. See \"systemctl status mssql-server.service\" and \"journalctl -xe\" for details.", "To force a start use \"systemctl reset-failed mssql-server.service\" followed by \"systemctl start mssql-server.service\" again."], "stdout": "\nThe licensing PID was successfully processed. The new edition is [Enterprise Evaluation Edition].\r\n\rThe license terms for this product can be found in\n/usr/share/doc/mssql-server or downloaded from:\nhttps://go.microsoft.com/fwlink/?LinkId=855862\n\nThe privacy statement can be viewed at:\nhttps://go.microsoft.com/fwlink/?LinkId=853010\n\nInput encoding cannot be detected. SQL Server will attempt to decode input as UTF-8\nConfiguring SQL Server...\nAttempting to start the Microsoft SQL Server service failed.", "stdout_lines": ["", "The licensing PID was successfully processed. The new edition is [Enterprise Evaluation Edition].", "", "The license terms for this product can be found in", "/usr/share/doc/mssql-server or downloaded from:", "https://go.microsoft.com/fwlink/?LinkId=855862", "", "The privacy statement can be viewed at:", "https://go.microsoft.com/fwlink/?LinkId=853010", "", "Input encoding cannot be detected. SQL Server will attempt to decode input as UTF-8", "Configuring SQL Server...", "Attempting to start the Microsoft SQL Server service failed."]}

Build fails for Ubuntu en Suse

Ansible

Paste the output of ansible --version here:

  - ansible_version=">=2.2,<2.3"
  - ansible_version=">=2.3,<2.4"
  - ansible_version=">=2.4,<2.5"

Operating system

Paste the output of cat /etc/*-release

platforms:
  - name: mssql-opensuse-42.3
    image: opensuse:42.3
  - name: mssql-ubuntu-xenial
    image: ubuntu:xenial

What are you seeing?

Ubuntu:

The following information may help to resolve the situation:
The following packages have unmet dependencies:
mssql-server-agent : Depends: mssql-server (>= 14.0.405.163-2) but it is not going to be installed

Suse:

installed mssql-server-14.0.3022.28-2.x86_64 obsoletes mssql-server-agent provided by mssql-server-agent-14.0.3015.40-1.x86_64

Maybe specific versions of packages can be installed instead of the latest found in the repository.

CA Certificates missing

Describe the bug

Failed to validate the SSL certificate for packages.microsoft.com:443. Make sure your managed systems have a valid CA certificate installed.

To Reproduce
Steps to reproduce the behavior:

  1. image="centos" tag="7" molecule test
  2. See error

Expected behavior
Just work.

Hint: use robertdebock.ca_certificates.

Depsolve error

Describe the bug

Depsolve Error occured: \n Problem: cannot install the best candidate for the job\n - nothing provides python needed by mssql-server-14.0.3356.20-23.x86_64

Playbook

---
- hosts: localhost
  roles:
    - robertdebock.bootstrap
    - robertdebock.ca_certificates
    - robertdebock.core_dependencies
    - robertdebock.microsoft_repository_keys
    - robertdebock.mssql

Output

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [robertdebock.bootstrap : include assert.yml] *****************************
included: /etc/ansible/roles/robertdebock.bootstrap/tasks/assert.yml for localhost

TASK [robertdebock.bootstrap : test if bootstrap_user is set correctly] ********
ok: [localhost]

TASK [robertdebock.bootstrap : test if bootstrap_wait_for_host is set correctly] ***
ok: [localhost]

TASK [robertdebock.bootstrap : test if bootstrap_timeout is set correctly] *****
ok: [localhost]

TASK [robertdebock.bootstrap : test if bootstrap_retries is set correctly] *****
ok: [localhost]

TASK [robertdebock.bootstrap : wait for host] **********************************
skipping: [localhost]

TASK [robertdebock.bootstrap : test connection] ********************************
[WARNING]: Reset is not implemented for this connection
ok: [localhost]

TASK [robertdebock.bootstrap : set bootstrap_ansible_user] *********************
ok: [localhost]

TASK [robertdebock.bootstrap : gather ansible facts] ***************************
ok: [localhost]

TASK [robertdebock.bootstrap : install bootstrap packages] *********************
ok: [localhost] => (item=python3)
ok: [localhost] => (item=sudo)

TASK [robertdebock.ca_certificates : install ca_certificates] ******************
ok: [localhost]

TASK [robertdebock.core_dependencies : install packages] ***********************
changed: [localhost]

TASK [robertdebock.core_dependencies : try to install pip packages] ************
changed: [localhost]

RUNNING HANDLER [robertdebock.core_dependencies : gather facts] ****************
ok: [localhost]

TASK [robertdebock.microsoft_repository_keys : add apt key] ********************
skipping: [localhost]

TASK [robertdebock.mssql : include assert.yml] *********************************
included: /etc/ansible/roles/robertdebock.mssql/tasks/assert.yml for localhost

TASK [robertdebock.mssql : test if mssql_add_repositories is set correctly] ****
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_version is set correctly] *************
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_server_version is set correctly] ******
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_server_agent_version is set correctly] ***
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_sa_password is set correctly] *********
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_pid is set correctly] *****************
ok: [localhost]

TASK [robertdebock.mssql : test if mssql_fts is set correctly] *****************
ok: [localhost]

TASK [robertdebock.mssql : add yum repository packages-microsoft-com-mssql-server-2019] ***
changed: [localhost] => (item=packages-microsoft-com-mssql-server-2017)
changed: [localhost] => (item=packages-microsoft-com-prod)

TASK [robertdebock.mssql : add apt repository] *********************************
skipping: [localhost] => (item={'repo': 'https://packages.microsoft.com/ubuntu/16.04/prod'}) 
skipping: [localhost] => (item={'repo': 'https://packages.microsoft.com/ubuntu/16.04/mssql-server-2019'}) 

TASK [robertdebock.mssql : install software mssql-server (package)] ************
fatal: [localhost]: FAILED! => {"changed": false, "failures": [], "msg": "Depsolve Error occured: \n Problem: cannot install the best candidate for the job\n  - nothing provides python needed by mssql-server-14.0.3356.20-23.x86_64", "rc": 1, "results": []}

PLAY RECAP *********************************************************************
localhost                  : ok=23   changed=3    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0

Environment

  • Control node OS:
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  • Control node Ansible version:
  ansible 2.9.14
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jeusdi/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Jul 20 2020, 15:37:01) [GCC 7.5.0]
  • Managed node OS:
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

Please consider sponsoring me.

Wrong repository URL on Centos ?

Describe the bug
When trying to run the role on Centos 7 (Other distributions not tested), the repository cannot be read (404)

To Reproduce
Steps to reproduce the behavior:

  1. Run this role on Centos 7
  2. See error

Expected behavior
No errors :)

Error
Failing step

TASK [robertdebock.mssql : install software mssql-server (package)] ***************************************************
Tuesday 16 October 2018  11:10:38 +0200 (0:00:00.278)       0:00:56.869 *******
fatal: [10.11.2.104]: FAILED! => {"changed": false, "msg": "Failure talking to yum: failure: repodata/repomd.xml from mssql: [Errno 256] No more mirrors to try.\nhttps://packages.microsoft.com/rhel/7/mssql-server/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found"}

Environment

  • Control node OS: OSX
  • Control node Ansible version: 2.6.3
  • Managed node OS: Centos 7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.