mariancraciun1983.corosync_pacemaker
Ansible Role for Pacemaker and Corosync Cluster
This is an Ansible role to install and set up a cluster using Corosync and Pacemaker.
Introduction
Pacemaker and Corosync are popular tools for creating high availability clusters. They help ensure that your services stay running, even if some parts of the system fail. The Pacemaker/Corosync Configuration System makes it easy to configure these tools.
Ansible
This role has been tested with Ansible versions 2.8, 2.9, and 2.10. It works on:
- Ubuntu
- focal
- bionic
Using different operating systems in the same cluster can cause issues with package versions. It's best to use the same version across all systems. For example, "focal" comes with corosync 3.0, while "bionic" has version 2.4.
Variables
Here’s an example of how to configure the settings:
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
If you want to use an internal network:
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
Testing
We use Molecule with Docker for testing.
To run the tests:
pipenv install
pipenv run molecule test
Install corosync and configure a cluster with pacemaker
ansible-galaxy install mariancraciun1983.corosync_pacemaker