generated from linux-system-roles/template
-
Notifications
You must be signed in to change notification settings - Fork 20
/
mssql_conf_setting.yml
48 lines (46 loc) · 1.8 KB
/
mssql_conf_setting.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
# SPDX-License-Identifier: MIT
---
- name: Get the {{ __mssql_conf_setting }} setting
shell: >-
grep ^{{ __mssql_conf_setting | regex_replace( '^.*\s' ,'') | quote }}
/var/opt/mssql/mssql.conf || true
changed_when: false
register: __mssql_conf_get_setting
- name: Configure the {{ __mssql_conf_setting }} setting
command: >-
/opt/mssql/bin/mssql-conf set {{ __mssql_conf_setting |
regex_replace( ' ','.') }} {{ __mssql_conf_setting_value | quote }}
vars:
__mssql_conf_get_value: >-
{{ __mssql_conf_get_setting.stdout |
regex_replace('^.*\s=\s', '') }}
when: >-
(__mssql_conf_setting_value != 'unset') and
(("No setting for the given" in __mssql_conf_get_setting.stdout) or
((__mssql_conf_setting_value | type_debug != "bool") and
(__mssql_conf_setting_value | string | lower not in
__mssql_conf_get_value | lower)) or
((__mssql_conf_setting_value | type_debug == "bool") and
(__mssql_conf_setting_value != __mssql_conf_get_value | bool)))
register: __mssql_conf_set
failed_when:
- >-
("error" in __mssql_conf_set.stdout | lower) or
(__mssql_conf_set is failed)
- >-
"is already in use. Please use another port" not in
__mssql_conf_set.stdout
changed_when: >-
"SQL Server needs to be restarted in order to apply this setting." in
__mssql_conf_set.stdout
notify: Restart the mssql-server service
- name: Unset the {{ __mssql_conf_setting }} setting
command: /opt/mssql/bin/mssql-conf unset {{ __mssql_conf_setting }}
when:
- __mssql_conf_setting_value == "unset"
- '"No setting for the given" not in __mssql_conf_get_setting.stdout'
register: __mssql_conf_unset
failed_when: >-
("error" in __mssql_conf_unset.stdout | lower) or
(__mssql_conf_unset is failed)
notify: Restart the mssql-server service