-
Notifications
You must be signed in to change notification settings - Fork 17
/
ha-tools.yml
308 lines (250 loc) · 8.09 KB
/
ha-tools.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#!/usr/bin/env ansible-playbook
##############################################################
# Author: Gholamreza Sabery Tabrizy
# Email: reza_sabery_89@yahoo.com
# Project Repository: https://github.com/ghrst/Kamailio-HA
##############################################################
#Very Important:: Be sure that host name of your nodes are not equal!
- name: Install and configure Corosync, Pacemaker and Crmsh
hosts: kamailio
become: False
vars_files:
- settings.yml
tasks:
- name: Installing prerequisites for compiling Corosync and Pacemaker
apt:
update_cache: yes
name:
- build-essential
- automake
- autoconf
- libtool
- pkg-config
- libnss3-dev
- groff
- libaio-dev
- libtool-bin
- libglib2.0-dev
- libxml2-dev
- libbz2-dev
- uuid-dev
- uuid
- libxslt1-dev
- libncurses5-dev
- python-lxml
- name: Downloading libpq's source package
get_url:
url: https://github.com/ClusterLabs/libqb/archive/v0.17.0.tar.gz
dest: /usr/src/libpq-0.17.0.tar.gz
- name: Un-taring libpq's archive
unarchive:
src: /usr/src/libpq-0.17.0.tar.gz
dest: /usr/src
copy: no
- name: Echoing version to .tarball_version refer to http://clusterlabs.org/wiki/Compiling_on_Debian#Update_for_Debian_8.0_.22Jessie.22
shell: echo "0.17.0" > .tarball-version
args:
chdir: /usr/src/libqb-0.17.0
- name: ./autogen.sh
shell: ./autogen.sh
args:
chdir: /usr/src/libqb-0.17.0
- name: ./configure
shell: ./configure
args:
chdir: /usr/src/libqb-0.17.0
- name: Compiling Libpq
shell: make
args:
chdir: /usr/src/libqb-0.17.0
- name: make install
shell: make install
args:
chdir: /usr/src/libqb-0.17.0
- name: Downloading Corosync's source code
get_url:
url: https://github.com/corosync/corosync/archive/v2.3.3.tar.gz
dest: /usr/src/corosync-2.3.3.tar.gz
- name: Un-taring Corosync's source archive
unarchive:
src: /usr/src/corosync-2.3.3.tar.gz
dest: /usr/src/
copy: no
- name: Echoing version to .tarball_version refer to http://clusterlabs.org/wiki/Compiling_on_Debian#Update_for_Debian_8.0_.22Jessie.22
shell: echo "2.3.3" > .tarball-version
args:
chdir: /usr/src/corosync-2.3.3
- name: ./autogen.shell
shell: ./autogen.sh
args:
chdir: /usr/src/corosync-2.3.3
- name: ./configure
shell: ./configure
args:
chdir: /usr/src/corosync-2.3.3
- name: Compiling Corosync
shell: make
args:
chdir: /usr/src/corosync-2.3.3
- name: Installing Corosync
shell: make install
args:
chdir: /usr/src/corosync-2.3.3
- name: Copying Corosync's init script
copy:
src: files/corosync.init
dest: /etc/init.d/corosync
force: yes
mode: "a+x"
- name: Downloading Cluster-Glue's source code
get_url:
url: http://hg.linux-ha.org/glue/archive/glue-1.0.12.tar.bz2
dest: /usr/src/
- name: Un-taring Cluster-Glue's source archive
unarchive:
src: /usr/src/glue-1.0.12.tar.bz2
dest: /usr/src/
copy: no
- name: ./autogen.shell
shell: ./autogen.sh
args:
chdir: usr/src/Reusable-Cluster-Components-glue--glue-1.0.12
- name: ./configure
shell: ./configure --enable-fatal-warnings=no
args:
chdir: /usr/src/Reusable-Cluster-Components-glue--glue-1.0.12
- name: Compiling Cluster-Glue
shell: make
args:
chdir: /usr/src/Reusable-Cluster-Components-glue--glue-1.0.12
- name: Installing Cluster-Glue
shell: make install
args:
chdir: /usr/src/Reusable-Cluster-Components-glue--glue-1.0.12
- name: Downloading Resource Agents
get_url:
url: https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
dest: /usr/src/
- name: Un-taring Resource Agent's archive
unarchive:
src: /usr/src/resource-agents-3.9.6.tar.gz
dest: /usr/src/
copy: no
- name: Echoing version to .tarball_version refer to http://clusterlabs.org/wiki/Compiling_on_Debian#Update_for_Debian_8.0_.22Jessie.22
shell: echo "3.9.5" > .tarball-version
args:
chdir: /usr/src/resource-agents-3.9.6
- name: ./autogen.sh
shell: ./autogen.sh
args:
chdir: /usr/src/resource-agents-3.9.6
- name: ./configure
shell: ./configure
args:
chdir: /usr/src/resource-agents-3.9.6
- name: Compiling Resource Agents
shell: make
args:
chdir: /usr/src/resource-agents-3.9.6
- name: Installing Resource Agents
shell: make install
args:
chdir: /usr/src/resource-agents-3.9.6
- name: Adding a group for pacemaker
group:
name: haclient
system: yes
state: present
- name: Adding a user for Pacemaker
user:
name: hacluster
system: yes
createhome: no
group: haclient
- name: Downloading Pacemaker's Source code
get_url:
url: https://github.com/ClusterLabs/pacemaker/archive/Pacemaker-1.1.13.tar.gz
dest: /usr/src
- name: Un-taring Pacemaker's source code!
unarchive:
src: /usr/src/pacemaker-Pacemaker-1.1.13.tar.gz
dest: /usr/src
copy: no
- name: ./autogen.sh
shell: ./autogen.sh
args:
chdir: /usr/src/pacemaker-Pacemaker-1.1.13
- name: ./configure
shell: ./configure
args:
chdir: /usr/src/pacemaker-Pacemaker-1.1.13
- name: make
shell: make
args:
chdir: /usr/src/pacemaker-Pacemaker-1.1.13
- name: make install
shell: make install
args:
chdir: /usr/src/pacemaker-Pacemaker-1.1.13
- name: Downloading crmsh's source code
get_url:
url: https://github.com/ClusterLabs/crmsh/archive/2.1.0.tar.gz
dest: /usr/src/crmsh-2.1.0.tar.gz
- name: Un-taring crmsh's source code
unarchive:
src: /usr/src/crmsh-2.1.0.tar.gz
dest: /usr/src
copy: no
- name: ./autogen.sh
shell: ./autogen.sh
args:
chdir: /usr/src/crmsh-2.1.0
- name: ./configure
shell: ./configure
args:
chdir: /usr/src/crmsh-2.1.0
- name: Compiling crmsh
shell: make
args:
chdir: /usr/src/crmsh-2.1.0
- name: Installing crmsh
shell: make install
args:
chdir: /usr/src/crmsh-2.1.0
- name: Adding Default Start runlevels to Corosync's init script
lineinfile:
dest: /etc/init.d/corosync
regexp: "^# Default-Start:"
line: "# Default-Start: 2 3 4 5"
state: present
- name: Adding Default Start runlevels to Pacemaker's init script
lineinfile:
dest: /etc/init.d/pacemaker
regexp: "^# Default-Start:"
line: "# Default-Start: 2 3 4 5"
state: present
- name: Adding corosync to different runlevels
shell: update-rc.d corosync defaults
- name: Adding pacemaker to different runlevels
shell: update-rc.d pacemaker defaults
- name: Copying corosync configuration template to each machine!
template:
src: templates/corosync.conf
dest: /etc/corosync/corosync.conf
force: yes
notify: restart corosync
- name: Creating /var/log/corosync
file:
path: /var/log/corosync
state: directory
owner: hacluster
group: haclient
mode: 0755
- name: Start Corosync
service:
name: corosync
state: started
- name: Start Pacemaker
service:
name: pacemaker
state: started