Skip to content

Commit fbb0417

Browse files
author
Michiel Piscaer
committed
integrating pacemaker-remote
1 parent 4a1d613 commit fbb0417

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

handlers/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@
55
enabled: yes
66
with_items:
77
- corosync
8-
- pacemaker
9-
- pacemaker-remote

templates/corosync.conf.j2

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
{% set _pacemaker_corosync_bind_addr = hostvars[inventory_hostname]['ansible_' + pacemaker_corosync_ring_interface | replace('-', '_')].ipv4.address %}
1+
{% if inventory_hostname in groups[pacemaker_corosync_group] %}
2+
{% set _pacemaker_corosync_bind_addr = hostvars[inventory_hostname]['ansible_eth1' | replace('-', '_')].ipv4.address %}
3+
{% else %}
4+
{% set _pacemaker_corosync_bind_addr = hostvars[inventory_hostname]['ansible_' + pacemaker_corosync_ring_interface | replace('-', '_')].ipv4.address %}
5+
{% endif %}
6+
27
totem {
38
version: 2
49
cluster_name: {{ pacemaker_corosync_group }}
@@ -28,16 +33,21 @@ quorum {
2833

2934
{% if pacemaker_enable_nodelist|default(true) %}
3035
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 %}
3243
node {
33-
ring0_addr: {{ hostvars[node]['ansible_' + pacemaker_corosync_ring_interface | replace('-', '_')].ipv4.address }}
44+
ring0_addr: {{ hostvars[node]['ansible_' + _tmp_pacemaker_corosync_ring_interface | replace('-', '_')].ipv4.address }}
3445
name: {{ pacemaker_corosync_fqdn | bool | ternary(hostvars[node].ansible_fqdn, node) }}
3546
nodeid: {{ loop.index }}
3647
}
3748
{% endfor %}
38-
}
3949
{% endif %}
40-
50+
}
4151
logging {
4252
to_logfile: {{ (pacemaker_corosync_use_logfile | bool) | ternary('yes', 'no') }}
4353
{% if pacemaker_corosync_use_logfile | bool %}

0 commit comments

Comments
 (0)