Git Product home page Git Product logo

ansible-collection-windows_sql_server's Introduction

ansible-collection-windows_sql_server

This collection contains example roles for setting up Windows SQL Server Stand Alone or AlwaysOn cluster.

This collection is meant for demo purposes only to set up a simple SQL Server AlwaysOn cluster, you would want to adopt and extend it using other SQLServerDsc resources for your specific use case and any required Ansible Windows modules.

It includes the following roles:

  • ad_availability_group
  • alwayson
  • alwayson_common
  • install
  • sql_users

Publishing to Ansible Galaxy

This section provides a guide on how to build and publish this collection to the Ansible Galaxy.

Generating the Changelog

  1. Navigate to the root directory of your local repository where galaxy.yml is located.
  2. Run the following command to build the collection:
    antsibull-changelog release

Building the Collection

  1. Navigate to the root directory of your local repository where galaxy.yml is located.
  2. Run the following command to build the collection:
    ansible-galaxy collection build

Publishing the Collection

  1. Navigate to the root directory of your local repository where galaxy.yml is located.
  2. Run the following command to publish the collection:
    ansible-galaxy collection publish oatakan-windows_sql_server-1.0.0.tar.gz

Requirements

  • oatakan.windows_cluster (collection)

Usage

Install this collection locally:

ansible-galaxy collection install oatakan.windows_sql_server -p ./collections

Then you can use the roles from the collection in your playbooks.

For SQL Server Stand Alone:

 ---
 - hosts: all
   roles:
     - oatakan.windows_sql_server.install

For SQL Server AlwaysOn cluster:

---
- name: install sql server on all nodes
  hosts: all
  vars:
    sql_server_local_users: true # use local users
  roles:
    - oatakan.windows_cluster.join_domain
    - oatakan.windows_cluster.failover_common
    - oatakan.windows_sql_server.sql_users # create users
    - oatakan.windows_sql_server.install
    - oatakan.windows_sql_server.alwayson_common

- name: set up cluster (primary)
  hosts: primary_server
  roles:
    - role: oatakan.windows_cluster.failover
      first_node: true
  post_tasks:
    # this will set the ip address and hostname of the first node so that it's acccessible from the subsequent plays.
    - name: set cluster_first node
      add_host:
        name: cluster_first
        ip_address:  "{{ ansible_ip_addresses[0] | default(ansible_host) | default(ansible_ssh_host) }}"
        ansible_hostname: "{{ ansible_hostname | default(ansible_host) | default(ansible_ssh_host) }}"

- name: set up cluster (secondary)
  hosts: secondary_server
  roles:
    - role: oatakan.windows_cluster.failover
      first_node: false

# after fully functional Windows cluster, we move onto setting up alwayson cluster
- name: alwayson configuration (primary)
  hosts: primary_server
  roles:
    - oatakan.windows_sql_server.ad_availability_group # this needs to be set up once per AD
    - role: oatakan.windows_sql_server.alwayson
      first_node: true

- name: alwayson configuration (secondary)
  hosts: secondary_server
  roles:
    - role: oatakan.windows_sql_server.alwayson
      first_node: false

ansible-collection-windows_sql_server's People

Contributors

oatakan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-collection-windows_sql_server's Issues

Issues with svc accounts

Hi Oatakan,
first of all thanks a lot for your collection.
I'm having an issue on the installation part.
I'm using the install package and i'm not undestanding something on the variables i guess.
By following your readme:

sql_server_svc_account_name: SASQLSvcAccount
sql_server_agt_svc_account_name: SAAgtSvcAccount
sql_server_svc_accounts_password: ''
sql_server_local_users: false # set this to true to create local users instead of domain users

I've undestood that if i enable true the installation will create SASQLSvcAccount and SAAgtSvcAccount as local accounts.
My problem is that the playbook fails and if check logs on the win vm i see this:

Overall summary:
Final result: Failed: see details below
Exit code (Decimal): -2061762559
Exit facility code: 1308
Exit error code: 1
Exit message: Account 'SAAgtSvcAccount' provided for service 'SQLSERVERAGENT' does not exist. Provide an existing account name for the service.
Start time: 2023-05-29 13:44:46
End time: 2023-05-29 13:45:29
Requested action: Install

Setup completed with required actions for features.
Troubleshooting information for those features:
Next step for SQLEngine: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Replication: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for FullText: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for ComponentUpdate: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for SNAC: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for SNAC_SDK: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Writer: SQL Server Setup was canceled before completing the operation. Try the setup process again.
Next step for Browser: SQL Server Setup was canceled before completing the operation. Try the setup process again.

I'm questioning my undestanding on the task at this point because i don't know if the accounts are being created or they have to be created before install

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.