bloxberg.corosync_pacemaker
Pacemaker und Corosync Cluster Ansible-Rolle mit Booth-Unterstützung
Ansible-Rolle zur Installation und Konfiguration eines Clusters mit Corosync und Pacemaker
Einführung
Pacemaker und Corosync sind eines der am häufigsten verwendeten Hochverfügbarkeits-Cluster-Stacks. Das Pacemaker/Corosync-Konfigurationssystem ist ein Werkzeug, um Pacemaker und Corosync einfach zu konfigurieren.
Ansible
Diese Rolle wurde mit Ansible-Versionen 2.8, 2.9 und 2.10 getestet. Die unterstützten Plattformen sind:
- Ubuntu
- focal
- bionic
Es wird stark empfohlen, nur eine Version in allen Clustern zu verwenden, da das Mischen verschiedener Distributionen unterschiedliche Paketversionen installieren kann. Zum Beispiel kommt focal mit corosync 3.0 und bionic mit Version 2.4.
Variablen
Beispielkonfiguration
group_vars:
all:
corosync_hacluster_password: 1q2w3e4r5t
corosync_cluster_settings:
- key: stonith-enabled
value: "false"
- key: no-quorum-policy
value: ignore
- key: start-failure-is-fatal
value: "false"
- key: symmetric-cluster
value: "false"
corosync_cluster_defaults:
- key: resource-stickiness
value: 100
Wenn Sie ein internes Netzwerk verwenden möchten
group_vars:
all:
corosync_use_internal_ip: true
host_vars:
node1:
internal_ip: 10.0.0.1
node2:
internal_ip: 10.0.0.2
node3:
internal_ip: 10.0.0.3
Multi-Site-Cluster-Konfiguration
all:
children:
newyork:
vars:
totem_cluster_name: 'NewYork'
hacluster_password: 'randomgeneriertePasswort'
ansible_connection: local
booth_type: 'site'
booth_ip: '10.254.1.15'
booth_config: 'setup'
hosts:
ny01:
ansible_host: '10.254.1.15'
ansible_hostname: 'ny01'
london:
vars:
totem_cluster_name: 'London'
hacluster_password: 'randomgeneriertePasswort'
ansible_connection: ssh
booth_type: site
booth_ip: '10.254.2.15'
booth_config: 'pull'
hosts:
ld01:
ansible_host: '10.254.2.8'
ansible_hostname: 'ld01'
ld02:
ansible_host: '10.254.2.9'
ansible_hostname: 'ld02'
munich:
vars:
totem_cluster_name: 'München'
hacluster_password: 'randomgeneriertePasswort'
ansible_connection: ssh
booth_type: arbitrator
booth_ip: '10.254.3.15'
booth_config: 'pull'
hosts:
muc01:
ansible_host: '10.254.3.9'
ansible_hostname: 'muc01'
muc02:
ansible_host: '10.254.3.10'
ansible_hostname: 'muc01'
muc03:
ansible_host: '10.254.3.11'
ansible_hostname: 'muc01'
Der Clusterstandort mit booth_config 'setup' generiert die Booth-Konfiguration. Die anderen Clusterstandorte ziehen dann diese Konfiguration. Es sollte nur einen Clusterstandort geben, der als 'setup' konfiguriert ist, und alle anderen als 'pull'. Bei der Bereitstellung ist es wichtig, den Standort mit booth_config 'setup' zuerst zu priorisieren, um sicherzustellen, dass die Konfiguration entsprechend für die 'pull'-Standorte durchgeführt wird.
Tests
Molecule mit Docker wird verwendet.
Tests ausführen:
pipenv install
pipenv run molecule test