File tree Expand file tree Collapse file tree 4 files changed +32
-8
lines changed Expand file tree Collapse file tree 4 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ Deploys corosync/pacemaker
6
6
# Variables
7
7
8
8
- ` pacemaker_corosync_group ` : Ansible group name for corosync cluster (default: false, * mandatory* )
9
+ - ` pacemaker_remote_group ` : Ansible group name for pacemaker-remote cluster (default: false, * mandatory* )
9
10
- ` pacemaker_corosync_ring_interface ` : Interface to use for ring0 communications (default: false, * mandatory* )
10
11
- ` pacemaker_corosync_fqdn ` : Whether use inventory_hostname or ansible_fqdn as node name for corosync (default: false)
11
-
Original file line number Diff line number Diff line change 5
5
enabled : yes
6
6
with_items :
7
7
- corosync
8
- - pacemaker
Original file line number Diff line number Diff line change 5
5
- ansible_os_family | lower == 'redhat'
6
6
- ansible_distribution_major_version is version('8', '=')
7
7
8
- - name : Installs pacemaker & corosync
8
+ - name : Installs corosync
9
9
package :
10
10
name : " {{ item }}"
11
11
state : present
12
12
with_items :
13
13
- corosync
14
+
15
+ - name : Installs pacemaker
16
+ package :
17
+ name : " {{ item }}"
18
+ state : present
19
+ with_items :
14
20
- pacemaker
21
+ when : " inventory_hostname in groups[pacemaker_corosync_group]"
22
+
23
+ - name : Installs pacemaker-remote
24
+ package :
25
+ name : " {{ item }}"
26
+ state : present
27
+ with_items :
28
+ - pacemaker-remote
29
+ when : " inventory_hostname in groups[pacemaker_remote_group]"
15
30
16
31
- name : Install haveged
17
32
package :
Original file line number Diff line number Diff line change 1
- {% set _pacemaker_corosync_bind_addr = hostvars [inventory_hostname ]['ansible_' + pacemaker_corosync_ring_interface | replace ('-' , '_' )].ipv 4.address %}
1
+ {% if inventory_hostname in groups [pacemaker_corosync_group ] %}
2
+ {% set _pacemaker_corosync_bind_addr = hostvars [inventory_hostname ]['ansible_eth1' | replace ('-' , '_' )].ipv 4.address %}
3
+ {% else %}
4
+ {% set _pacemaker_corosync_bind_addr = hostvars [inventory_hostname ]['ansible_' + pacemaker_corosync_ring_interface | replace ('-' , '_' )].ipv 4.address %}
5
+ {% endif %}
6
+
2
7
totem {
3
8
version: 2
4
9
cluster_name: {{ pacemaker_corosync_group }}
@@ -28,16 +33,21 @@ quorum {
28
33
29
34
{% if pacemaker_enable_nodelist |default (true ) %}
30
35
nodelist {
31
- {% for node in groups [pacemaker_corosync_group ]|sort %}
36
+
37
+ {% for node in groups [pacemaker_remote_group ]|sort + groups [pacemaker_corosync_group ]|sort %}
38
+ {% if node in groups [pacemaker_corosync_group ] %}
39
+ {% set _tmp_pacemaker_corosync_ring_interface = 'eth1' %}
40
+ {% else %}
41
+ {% set _tmp_pacemaker_corosync_ring_interface = pacemaker_corosync_ring_interface %}
42
+ {% endif %}
32
43
node {
33
- ring0_addr: {{ _pacemaker_corosync_bind_addr }}
44
+ ring0_addr: {{ hostvars[nod e] ['ansible_' + _tmp_pacemaker_corosync_ring_interface | replace('-', '_' )] .ipv4.address }}
34
45
name: {{ pacemaker_corosync_fqdn | bool | ternary(hostvars[node] .ansible_fqdn, node) }}
35
46
nodeid: {{ loop.index }}
36
47
}
37
48
{% endfor %}
38
- }
39
49
{% endif %}
40
-
50
+ }
41
51
logging {
42
52
to_logfile: {{ (pacemaker_corosync_use_logfile | bool) | ternary('yes', 'no') }}
43
53
{% if pacemaker_corosync_use_logfile | bool %}
You can’t perform that action at this time.
0 commit comments