Giter VIP home page Giter VIP logo

pacemaker-cookbook's Introduction

pacemaker Cookbook

Build Status

Note: This project is no longer active

Cookbook that sets up a pacemaker cluster.

Requirements

platforms

Platform CLI Resource Mgmt Engine Supported?
RHEL 7.1 PCS Pacemaker Corosync Yes
RHEL 6.5 CRM CMAN Corosync No

Attributes

Below is a list of attributes that you are most likely to change. see attributes/default.rb for a full list of attributes.

  • ['pacemaker']['corosync']['cluster_name'] ('My_Cluster') - Name of the cluster
  • ['pacemaker']['corosync']['nodes'] ({}) - List of the cluster's nodes and ip addresses
  • ['pacemaker']['pcs']['vault'] ('vault_pacemaker') - Vault containing item with secrets for pacemaker
  • ['pacemaker']['pcs']['vault_item'] ('secrets') - Vault Item containing secrets for pacemaker

Resources/Providers

pacemaker_primitive

Configure and delete primitive resource.

This resource manages pacemaker-resource primitives, supporting the following actions:

  • :create
  • :delete

Examples

pacemaker_primitive 'drbd' do
  agent "ocf:linbit:drbd"
  params 'drbd_resource' => 'r0'
  op 'monitor' => { 'interval' => '5s', 'role' => 'Master' }
  action :create
end
pacemaker_primitive 'galera' do
  agent "ocf:heartbeat:galera"
  params 'wsrep_cluster_address' => 'node1,node2,node3'
  op 'monitor' => { 'interval' => '5s', 'role' => 'Master'
  ms true
  meta 'master_max' => '1'
  action :create
end

pacemaker_property

Set and unset pacemaker properties.

This resource manages pacemaker properties, supporting the following actions:

  • :set
  • :unset

You will want to declare this resource after having created the cluster with the pacemaker::cluster_create recipe.

Examples

pacemaker_property 'default-resource-stickiness' do
  value 4999
end

pacemaker_property 'cluster-recheck-interval' do
  action :unset
end

pacemaker_stonith

Configure and delete stonith resource.

This resource manages pacemaker-resource stonith, supporting the following actions:

  • :create
  • :delete

Examples

pacemaker_stonith 'stonith-ucs' do
  agent  'ucs'
  params 'location' => 'b0s0'
  op     'monitor' => { 'interval' => '5s' }
  action :create
end
pacemaker_stonith 'stonith-scsi-sda' do
  agent  'fence_scsi'
  params 'devices' => '/dev/sda'
  meta   'provides' => 'unfencing'
  action :create
end

pacemaker_group

Configure and delete resource groups.

This resource manages pacemaker-resource group, supporting the following actions:

  • :create
  • :delete

Examples

pacemaker_group 'mygroup' do
  resources ['lbservice', 'vip']
  meta {}
  action :create
end

pacemaker_orderset

This resource manages the order pacemaker-contraint using the order set syntax, supporting the following actions:

  • :create
  • :delete

Examples

pacemaker_orderset 'start_neutron_layer3' do
  set        ['neutron-netns-clone',
              'neutron-server-clone',
              'neutron-l3-agent-clone',
              'neutron-metadata-agent-clone',
              'neutron-dhcp-agent-clone']
  options 'action' => 'start', 'sequential' => 'true'
  setoptions 'kind' => 'Mandatory'
end

Recipes

pacemaker::default

Include pacemaker::default in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[pacemaker::default]"
  ]
}

pacemaker::node_prepare

Installs required components to the node. Does not create or manage a cluster. This recipe assume you already in your run_list a cookbook/recipe to setup repos necessary for packages. You can always choose to just include yum::default in your run_list for default public repositories.

{
  "name":"my_node",
  "run_list": [
    "recipe[pacemaker::node_prepare]"
  ]
}

pacemaker::cluster_create

Creates a pacemaker cluster consisting of node['pacemaker']['corosync']['nodes'].

recipe[pacemaker::node_prepare] must have been ran on all nodes first.

This should be run only from 1 cluster node.

{
  "name":"my_node",
  "run_list": [
    "recipe[pacemaker::cluster_create]"
  ]
}

Testing

Testing utilizes ChefDK >= 0.10.0 with its native gems.

If you run into issues running tests please be sure you do not have extra gems installed in your ChefDK environment as they could cause conflicts.

To be sure you do not have any extra gems installed you can run rm -rf ~/.chefdk/gem to remove any extra gems.

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Author:: Travis Killoren ([email protected])

Copyright:: 2016, Target Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

pacemaker-cookbook's People

Contributors

desktophero avatar dswebbthg avatar jmccann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pacemaker-cookbook's Issues

Use of LWRP provider ordering issues

One of the main "problems" with this cookbook that really isn't addressed in the documentation is the issue of ordering.

Lets say you have a 3 node cluster (node1[master],node2[slave],node3[slave]) that you want to control. Before you can run any of the pacemaker::cluster_create scripts on node1, both node2/3 will have to have had the pacemaker::node_prepare recipes run against them. Any deviation from this ordering will cause failures in the chef runs.

Also, the various providers should really only be run against node1 in the cluster, as if you try to run them against node2/3 before the cluster creation is complete you will get errors in your chef run.

It would be ideal if there were information stored in some data bag or something that could be modified from within the recipes to inform the master that they've been successfully setup so the node_prepare or any primitive etc provider don't try and run until all "slave" nodes within the cluster have been setup.

ArgumentError-Property `resources` of resource `pacemaker_group` overwrites an existing method

I am trying to have wrapper cookbook over this and calling "include_recipe 'recipe[pacemaker::node_prepare]'" But running into a issue
"""""""""""""""
ArgumentError

Property resources of resource pacemaker_group overwrites an existing method. A different name should be used for this property.

Cookbook Trace:

/var/chef/cache/cookbooks/pacemaker/resources/group.rb:24:in `class_from_file'

/var/chef/cache/cookbooks/pacemaker/resources/group.rb:

17: # limitations under the License.
18: #
19:
20: actions :create, :delete
21: default_action :create
22:
23: attribute :name, kind_of: String, name_attribute: true
24>> attribute :resources, kind_of: Array, required: true

"""""""""""""

Unable to execute spec tests

The Testing section calls out ChefDK >= 0.10.0 as the only requirement:

─ chef -v
Chef Development Kit Version: 0.10.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2

I have a different library for net-ssh that appears to take precedence in Gem Load order

╰─ chef exec rspec
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:2273:in `check_version_conflict': can't activate net-ssh-3.0.2, already activated net-ssh-2.9.2 (Gem::LoadError)

There are other dependencies for the older net-ssh library.

Thoughts?

Update README

This cookbook is unusable without some hint as how to setup the vault as well as listing it as a requirement.

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.