Skip to content

Commit

Permalink
cluster: reconfigure
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Straka committed Mar 25, 2022
1 parent 0b8dfad commit c17c597
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
5 changes: 5 additions & 0 deletions cluster/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
systemd:
name: pacemaker
state: restarted

- name: reload corosync
shell: >
corosync-cfgtool -R
28 changes: 28 additions & 0 deletions cluster/tasks/reconfigure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- name: configure pacemaker systemd override
copy:
src: pacemaker_override.conf
dest: "/etc/systemd/system/pacemaker.service.d/override.conf"
tags: configure
notify:
- restart corosync
- restart pacemaker

- name: deploy corosync authkey
copy:
content: "{{ cluster.authkey|b64decode }}"
dest: /etc/corosync/authkey
mode: 0400
owner: root
group: root
tags: configure
notify:
- restart corosync
- restart pacemaker

- name: configure corosync
template:
src: corosync.conf
dest: /etc/corosync/corosync.conf
tags: configure
notify:
- reload corosync
22 changes: 16 additions & 6 deletions cluster/templates/corosync.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
totem {
version: 2
cluster_name: {{ cluster.name }}
token: 3000
token_retransmits_before_loss_const: 10
# How long before declaring a token lost (ms)
token: {{ cluster.token | default(3000) }}
# How many token retransmits before forming a new configuration
token_retransmits_before_loss_const: {{ cluster.retransmits | default(10) }}
# Limit generated nodeids to 31-bits (positive signed integers)
clear_node_high_bit: yes
{% if cluster.downcheck is defined %}
#how long to wait before checking that a network interface is back up after it has been downed
downcheck {{ cluster.downcheck | default(1000) }}
{% endif %}

crypto_cipher: aes128
crypto_hash: sha256
ip_version: ipv4
Expand All @@ -29,7 +37,7 @@ logging {
logfile: /var/log/corosync/corosync.log
to_syslog: yes
syslog_facility: daemon
debug: off
debug: {{ cluster.debug | default("off") }}
timestamp: on
logger_subsys {
subsys: QUORUM
Expand All @@ -54,9 +62,11 @@ quorum {
provider: corosync_votequorum
{% if cluster.members|length == 2 %}
two_node: 1
auto_tie_breaker: 0
wait_for_all: 1
last_man_standing: 1
#auto_tie_breaker: 1
# automaticaly set when two_node is true
#wait_for_all: 1
# this is working only on when number of running nodes >= 2 (on 2 node cluster this has no justification)
#last_man_standing: 1
{% else %}
#XXX: automatically counted? expected_votes: {{ (cluster.members|length // 2) + 1 }}
{% endif %}
Expand Down

0 comments on commit c17c597

Please sign in to comment.