-
Notifications
You must be signed in to change notification settings - Fork 364
/
config.sls
100 lines (93 loc) · 2.57 KB
/
config.sls
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{%- from tpldir ~ "/map.jinja" import mysql with context %}
{%- set os_family = salt['grains.get']('os_family', None) %}
{%- if "config_directory" in mysql %}
mysql_config_directory:
file.directory:
- name: {{ mysql.config_directory }}
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
- mode: 755
{%- endif %}
- makedirs: True
{%- if "server_config" in mysql %}
mysql_server_config:
file.managed:
- name: {{ mysql.config_directory + mysql.server_config.file }}
- template: jinja
- source: salt://{{ tpldir }}/files/server.cnf
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- context:
tpldir: {{ tpldir }}
- user: root
- group: root
- mode: 644
{%- endif %}
- require:
- file: mysql_config_directory
{%- endif %}
{%- if "galera_config" in mysql %}
mysql_galera_config:
file.managed:
- name: {{ mysql.config_directory + mysql.galera_config.file }}
- template: jinja
- source: salt://{{ tpldir }}/files/galera.cnf
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- context:
tpldir: {{ tpldir }}
- user: root
- group: root
- mode: 644
{%- endif %}
- require:
- file: mysql_config_directory
{%- endif %}
{%- if "library_config" in mysql %}
mysql_library_config:
file.managed:
- name: {{ mysql.config_directory + mysql.library_config.file }}
- template: jinja
- source: salt://{{ tpldir }}/files/client.cnf
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- context:
tpldir: {{ tpldir }}
- user: root
- group: root
- mode: 644
{%- endif %}
- require:
- file: mysql_config_directory
{%- endif %}
{%- if "clients_config" in mysql %}
mysql_clients_config:
file.managed:
- name: {{ mysql.config_directory + mysql.clients_config.file }}
- template: jinja
- source: salt://{{ tpldir }}/files/mysql-clients.cnf
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- context:
tpldir: {{ tpldir }}
- user: root
- group: root
- mode: 644
{%- endif %}
- require:
- file: mysql_config_directory
{%- endif %}
{%- endif %}
mysql_config:
file.managed:
- name: {{ mysql.config.file }}
- template: jinja
{%- if "config_directory" in mysql %}
- source: salt://{{ tpldir }}/files/my-include.cnf
{%- else %}
- source: salt://{{ tpldir }}/files/my.cnf
{%- endif %}
- context:
tpldir: {{ tpldir }}
{%- if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
- mode: 644
{%- endif %}