/
galera_post_install.yml
132 lines (123 loc) · 3.56 KB
/
galera_post_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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
# Copyright 2014, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create the local directories
file:
path: "{{ item.path }}"
state: "directory"
owner: "{{ item.owner|default('root') }}"
group: "{{ item.group|default('root') }}"
mode: "{{ item.mode|default('0755') }}"
recurse: "{{ item.recurse|default('false') }}"
with_items:
- { path: "/var/lib/mysql", owner: "mysql", mode: "2755" }
- { path: "/var/log/mysql", owner: "mysql", mode: "2755" }
- { path: "/var/log/mysql_logs", owner: "mysql", mode: "2755" }
- { path: "/etc/mysql/conf.d" }
tags:
- galera-config
- name: Drop mariadb config(s)
config_template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
mode: "0644"
config_overrides: "{{ item.config_overrides }}"
config_type: "{{ item.config_type }}"
with_items:
- src: my.cnf.j2
dest: /etc/mysql/my.cnf
config_overrides: "{{ galera_my_cnf_overrides }}"
config_type: "ini"
- src: cluster.cnf.j2
dest: /etc/mysql/conf.d/cluster.cnf
config_overrides: "{{ galera_cluster_cnf_overrides }}"
config_type: "ini"
- src: debian.cnf.j2
dest: /etc/mysql/debian.cnf
config_overrides: "{{ galera_debian_cnf_overrides }}"
config_type: "ini"
notify: Restart mysql
tags:
- galera-config
- galera-client-user-config
# NOTE: (mancdaz) this should not be needed with mariadb-10.1 since its
# initscript sources /etc/default/mariadb
- name: fix mysql startup timeout
lineinfile:
dest: /etc/init.d/mysql
state: present
insertafter: '^export HOME=/etc/mysql/'
line: '[ -r /etc/default/mysql ] && . /etc/default/mysql'
backup: yes
tags:
- galera-config
- name: Drop limits config (upstart)
template:
src: "upstart.limits.conf.j2"
dest: "/etc/security/limits.conf"
when:
- pid1_name != "systemd"
notify:
- Restart mysql
tags:
- galera-config
# NOTE: (mancdaz) REMOVE "/etc/default/mysql" when running MariaDB 10.1
- name: Apply resource limits (upstart)
template:
src: "mysql_defaults.j2"
dest: "{{ item }}"
mode: "0644"
with_items:
- /etc/default/mysql
- /etc/default/mariadb
when:
- ansible_pkg_mgr == 'apt'
- pid1_name != "systemd"
notify:
- Restart mysql
tags:
- galera-config
- name: Create mariadb systemd service config dir
file:
path: "/etc/systemd/system/mariadb.service.d"
state: "directory"
group: "root"
owner: "root"
mode: "0755"
when:
- pid1_name == "systemd"
- name: Apply resource limits (systemd)
template:
src: "systemd.limits.conf.j2"
dest: "/etc/systemd/system/mariadb.service.d/limits.conf"
mode: "0644"
when:
- pid1_name == "systemd"
notify:
- Reload the systemd daemon
- Restart mysql
tags:
- galera-config
- name: remove default mysql_safe_syslog
file:
path: "/etc/mysql/conf.d/mysqld_safe_syslog.cnf"
state: absent
tags:
- galera-config
- include: galera_upgrade_post.yml
static: no
when:
- galera_upgrade | bool