Coder Social home page Coder Social logo

ansible-role_pacemaker's Introduction

ansible-pacemaker

An Ansible role to install/configure pacemaker/corosync.

Requirements

Pacemaker cluster

The following requirements are specific requirements for cluster setup.

Number of Nodes

  • Up to 16 nodes per cluster.
  • Minimum number of nodes: 3.
  • 2 nodes cluster could be configured but is not recommended.

OS requirements

The following requirements are specific to OS deployments.

macOS

pip install passlib

Role Variables

---
# defaults file for ansible-pacemaker
corosync_authkey_file: '/etc/corosync/authkey'

# Defines interface used for cluster
corosync_bindnet_interface: 'enp0s8'

corosync_config_file: '/etc/corosync/corosync.conf'

# Defines the number of nodes to be functional in order to avoid split-brain
# scenarios...ex. 2-nodes = 1, 3-nodes = 2
corosync_expected_votes: "{{ ( groups[pacemaker_cluster_group]|count /2 ) | round (0, 'ceil') | int }}"

# Corosync itself works without a cluster name, but DLM needs one.
# The cluster name is also written into the VG metadata of newly
# created shared LVM volume groups, if lvmlockd uses DLM locking.
# It is also used for computing mcastaddr, unless overridden below.
corosync_cluster_name: 'debian'

# Setting corosync_last_man_standing to true enables the Last Man Standing (LMS) feature;
# by default, it is disabled (set to false)
corosync_last_man_standing: true

# Define multicast address to use for cluster
# this should be unique per cluster
corosync_mcastaddr: 239.255.42.1

# Define port number to configure as cluster port.
corosync_mcastport: 5405

# Defines if unicast mode should be used rather than multicast
corosync_unicast_mode: false

# Means that, When starting up a cluster (all nodes down), the cluster quorum
# is held until all nodes are online and have joined the cluster for the first
# time. This parameter is new in Corosync 2.0.
corosync_wait_for_all: true

pacemaker_cluster_constraints: []
  # - constraint: 'colocation'
  #   action: 'add'
  #   source_resource_id: 'webserver'
  #   target_resource_id: 'virtual_ip'
  #   score: 'INFINITY'
  # - constraint: 'order'
  #   order:
  #     first_resource: 'virtual_ip'
  #     first_resource_action: 'start'
  #     second_resource: 'webserver'
  #     second_resource_action: 'start'

pacemaker_cluster_group: 'ha_cluster'

pacemaker_cluster_resources: []
  # - resource_id: 'virtual_ip'
  #   action: 'create'
  #   provider: 'ocf:heartbeat:IPaddr2'
  #   options:
  #     - 'ip=192.168.250.200'
  #     - 'cidr_netmask=24'
  #   op: 'monitor'
  #   op_options:
  #     - 'interval=30s'
  # - resource_id: 'webserver'
  #   action: 'create'
  #   provider: 'ocf:heartbeat:nginx'
  #   options:
  #     - 'configfile=/etc/nginx/nginx.conf'
  #   op: 'monitor'
  #   op_options:
  #     - 'timeout=5s'
  #     - 'interval=5s'

# NOT RECOMMENDED FOR PRODUCTION!!!!!
# You must have a STONITH device to enable....
pacemaker_disable_stonith: true

# Define specific cluster settings to configure
pacemaker_cluster_settings: []
  # - property: 'start-failure-is-fatal'
  #   value: 'false'
  # - property: 'pe-warn-series-max'
  #   value: 1000
  # - property: 'pe-input-series-max'
  #   value: 1000
  # - property: 'pe-error-series-max'
  #   value: 1000
  # - property: 'cluster-recheck-interval'
  #   value: 5min

# Define hacluster user password for webUI
#
# Generate new password
# echo "haclusteradmin" | sha512sum
pacemaker_hacluster_password: 'f8d1feb7105dfbd2859a17512c7414f89b70dfef815b177444b897edec19a18724f8e9686f0e2daa41c48eb9b0511bae9e659a756f17c39fedb6d68b9230a53c'

# Defines if host is considered to be primary
# this should be set in host_vars/hostname as true for only one host
pacemaker_primary_server: '{{ groups[pacemaker_cluster_group][0] }}'

Dependencies

None

Example Playbook

---
- hosts: ha_cluster
  vars:
    etc_hosts_add_all_hosts: true
    pacemaker_cluster_constraints:
      - constraint: 'colocation'
        action: 'add'
        source_resource_id: 'webserver'
        target_resource_id: 'virtual_ip'
        score: 'INFINITY'
      - constraint: 'order'
        order:
          first_resource: 'virtual_ip'
          first_resource_action: 'start'
          second_resource: 'webserver'
          second_resource_action: 'start'
    pacemaker_cluster_resources:
      - resource_id: 'virtual_ip'
        action: 'create'
        provider: 'ocf:heartbeat:IPaddr2'
        options:
          - 'ip=192.168.250.200'
          - 'cidr_netmask=24'
        op: 'monitor'
        op_options:
          - 'interval=30s'
      - resource_id: 'webserver'
        action: 'create'
        provider: 'ocf:heartbeat:nginx'
        options:
          - 'configfile=/etc/nginx/nginx.conf'
        op: 'monitor'
        op_options:
          - 'timeout=5s'
          - 'interval=5s'
    pacemaker_cluster_settings:
      - property: 'start-failure-is-fatal'
        value: 'false'
      - property: 'pe-warn-series-max'
        value: 1000
      - property: 'pe-input-series-max'
        value: 1000
      - property: 'pe-error-series-max'
        value: 1000
      - property: 'cluster-recheck-interval'
        value: 5min
    pri_domain_name: 'test.vagrant.local'
  roles:
    - role: ansible-apt-sources
    - role: ansible-motd
    - role: ansible-ntp
    - role: ansible-timezone
      become: true
    - role: ansible-etc-hosts
    - role: ansible-pacemaker
      tags:
        - pacemaker
    - role: ansible-nginx
  tasks:

License

MIT

Author Information

Larry Smith Jr.

ansible-role_pacemaker's People

Contributors

shundezhang avatar mrlesmithjr avatar

Watchers

James Cloos avatar Joanna H. Huang avatar Kieran Spear avatar Tom Fifield avatar Alok Kumar avatar  avatar Lei Zhang avatar Simon Sellar avatar  avatar  avatar Salman Memon avatar Bharat Kumar Kobagana avatar RBalaGopal avatar  avatar Roland Chan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.