blob: b34f0d099b73f1cd0a665a00362a91adf0159862 (
plain)
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
|
---
- name: Check for required variables
block:
- fail:
msg: "Please provide required variable: ctdb_network_private_interfaces"
when: ctdb_network_private_interfaces is undefined
- fail:
msg: "Please provide these required variable: ctdb_network_public_interfaces"
when: ctdb_network_public_interfaces is undefined
- fail:
msg: "Please provide these required variable: ctdb_network_public_interface_subnet_mask"
when: ctdb_network_public_interface_subnet_mask is undefined
- fail:
msg: "Please provide these required variable: ctdb_network_public_interface_name"
when: ctdb_network_public_interface_name is undefined
- fail:
msg: "Please provide these required variable: ctdb_cluster_volume"
when: ctdb_cluster_volume is undefined
- fail:
msg: "Please provide these required variable: ctdb_cluster_replica_count"
when: ctdb_cluster_replica_count is undefined
- name: Create the ctdb replicated volume
gluster_volume:
state: present
name: "{{ ctdb_cluster_volume }}"
bricks: '{{ ctdb_brick_location }}/ctdb'
cluster: "{{ cluster_hosts }}"
replicas: "{{ ctdb_cluster_replica_count }}"
run_once: yes
- name: Mount and add CTDB lock volume to fstab
mount:
path: /gluster/lock/
src: 'localhost:/ctdb'
fstype: glusterfs
opts: '_netdev,transport=tcp,xlator-option=*client*.ping-timeout=10'
state: mounted
- name: Add ctdb package
yum:
name: ctdb
state: present
- name: Add ctdb rules to firewalld
firewalld:
service: ctdb
permanent: yes
state: enabled
- name: Add recovery lock to ctdb.conf
lineinfile:
dest: /etc/ctdb/ctdb.conf
line: "\trecovery lock = /gluster/lock/recovery.lock"
regexp: "recovery lock"
insertafter: '\[cluster\]'
- name: Install libsemanage-python. This is needed for the seboolean ansible command
yum: name=libsemanage-python state=present
- name: SELinux - Allow CTDB to access recovery lockfile from FUSE mount
seboolean:
name: use_fusefs_home_dirs
state: yes
persistent: yes
- name: Enable check consistency of databases during startup
command: '/bin/ctdb event script enable legacy 00.ctdb'
- name: Enable check consistency of databases during startup
command: '/bin/ctdb event script enable legacy 01.reclock'
- name: Enable monitor system resources
command: '/bin/ctdb event script enable legacy 05.system'
- name: Enable network interface management by ctdb
command: '/bin/ctdb event script enable legacy 10.interface'
- name: Enable samba management by ctdb
command: '/bin/ctdb event script enable legacy 50.samba'
- include_role:
name: gluster.features
vars:
gluster_features_ctdb_nodes: "{{ ctdb_network_private_interfaces | join(',') }}"
gluster_features_ctdb_publicaddr: "{{ ctdb_network_public_interfaces | map('regex_replace','(^.*$)','\\1/' + ctdb_network_public_interface_subnet_mask + ' ' + ctdb_network_public_interface_name) | list |join (',') }}"
gluster_features_ctdb_volume: "{{ ctdb_cluster_volume }}"
gluster_features_ctdb_enable_hook_scripts: false
- name: Restart ctdb
service: name=ctdb state=restarted enabled=yes
|