Giter Site home page Giter Site logo

ansible-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-pacemaker's People

Contributors

mrlesmithjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ansible-pacemaker's Issues

This task 'pacemaker' has extra params, which is only allowed in the following modules:...

This task 'pacemaker' has extra params, which is only allowed in the following modules:...

The code that triggers the error is:

- name: debian | configuring pacemaker cluster properties
  pacemaker: >
    property "{{ item.property }}"="{{ item.value }}"
  with_items: pacemaker_cluster_settings
  notify:
    - pacemaker commit
  when: pacemaker_cluster_settings is defined

- name: debian | disabling pacemaker STONITH
  pacemaker: >
    property stonith-enabled=false
  notify:
    - pacemaker commit
  when: pacemaker_disable_stonith is defined and pacemaker_disable_stonith

from the end of the debian.yml file

and if I uncomment the following lines in the handlers file:

# - name: pacemaker commit ###commented out for now...broken in ansible 2.0
#  pacemaker: commit

The same happens, Im using ansible 2.0.1.0. Any ideas whats going on? I'm new and ansible so I'm not much help debugging this kind of system

Cheers

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.