-
Notifications
You must be signed in to change notification settings - Fork 15
/
win_sql_install.yml
62 lines (52 loc) · 1.77 KB
/
win_sql_install.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- hosts: all
gather_facts: True
vars:
sql_instance_name: benz
tasks:
- debug: var=hostvars[inventory_hostname]
- name: create a directory for installer download
win_file:
path: c:\sql
state: directory
- name: create a directory for installer extraction
win_file:
path: c:\sql\installer
state: directory
- name: create the configuration file
win_template:
src: files/sql_conf.ini.j2
dest: c:\sql\sql_conf.ini
- name: a pre requisite of sql net-framework-35
win_feature:
name: NET-Framework-Core
state: present
- name: check downloaded file exists
win_stat:
path: c:\sql\sql_installer.exe
register: installer_file
- name: get the installer
win_get_url:
url: 'http://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/ExpressAndTools%2064BIT/SQLEXPRWT_x64_ENU.exe'
dest: 'c:\sql\sql_installer.exe'
when: not installer_file.stat.exists
- name: extract the installer
win_command: c:\sql\sql_installer.exe /q /x:c:\sql\installer
args:
chdir: c:\sql
creates: c:\sql\installer\setup.exe
- name: Install the database
win_command: c:\sql\installer\setup.exe /configurationfile=c:\sql\sql_conf.ini
args:
chdir: c:\sql
- name: Add or update registry for ip port
win_regedit:
path: 'HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL12.{{ sql_instance_name }}\MSSQLServer\SuperSocketNetLib\Tcp\IPAll'
name: TcpPort
data: 1433
register: win_reg
- name: Restart a service
win_service:
name: 'MSSQL${{ sql_instance_name }}'
force_dependent_services: yes
state: restarted
when: win_reg.changed