Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

gluster (11) Versions 5.3.0

Installs and configures Gluster servers and clients

Policyfile
Berkshelf
Knife
cookbook 'gluster', '= 5.3.0', :supermarket
cookbook 'gluster', '= 5.3.0'
knife supermarket install gluster
knife supermarket download gluster
README
Dependencies
Changelog
Quality 67%

gluster Cookbook

Build Status
Cookbook Version

This cookbook is used to install and configure Gluster on both servers and clients. This cookbook makes several assumptions when configuring Gluster servers:

  1. This cookbook is being run on at least two nodes, the exact number depends on the Gluster Volume type
  2. A second physical disk has been added, unformatted, to the server. This cookbook will install lvm and configure the disks automatically.
  3. All peers for a volume will be configured with the same number of bricks

Platforms

This cookbook has been tested on:
- Ubuntu 14.04
- Ubuntu 16.04
- Centos 6.8
- Centos 7.2

As this cookbook uses Semantic Versioning, major version number bumps are not backwards compatible. Especially the change from v4 to v5 will require a rebuild of the gluster nodes.

Attributes

gluster::default

  • node['gluster']['version'] - version to install, defaults to 3.8
  • node['gluster']['repo'] - repo to install from: can be public or private, defaults to public, private requires a so-called "private" repo to be configured in a wrapper cookbook for example

gluster::client

Node attributes to specify volumes to mount. This has been deprecated in favor of using the 'gluster_mount' LWRP.

  • node['gluster']['client']['volumes'][VOLUME_NAME]['server'] - server to connect to
  • node['gluster']['client']['volumes'][VOLUME_NAME]['backup_server'] - name of the backup volfile server to mount the client. When the first volfile server fails, then the server specified here is used as volfile server and is mounted by the client. This can be a String or Array of Strings.
  • node['gluster']['client']['volumes'][VOLUME_NAME]['mount_point'] - mount point to use for the Gluster volume

gluster::server

Node attributes to specify server volumes to create

The absolute minimum configuration is:
- node['gluster']['server']['disks'] - an array of disks to create partitions on and format for use with Gluster, (for example, ['/dev/sdb', '/dev/sdc'])
- node['gluster']['server']['volumes'][VOLUME_NAME]['peers'] - an array of FQDNs for peers used in the volume
- node['gluster']['server']['volumes'][VOLUME_NAME]['volume_type'] - the volume type to use; this value can be 'replicated', 'distributed-replicated', 'distributed', 'striped' or 'distributed-striped'
- node['gluster']['server']['volumes'][VOLUME_NAME]['size'] - The size of the gluster volume you would like to create, for example, 100M or 5G. This is passed through to the lvm cookbook and uses the syntax defined here: https://github.com/chef-cookbooks/lvm .

gluster::geo_replication

Node attributes to specify mountbroker details.

  • node['gluster']['mountbroker]['path'] - The mountbroker path. Defaults to /var/mountbroker-root. This does not need to exist beforehand.
  • node['gluster']['mountbroker]['group'] - The mountbroker group. Defaults to geogroup. This will be created as a system group if it does not exist already.
  • node['gluster']['mountbroker]['users'] - A hash of users to volumes for allowing access. Empty by default. Multiple volumes can be given as an array. Neither the user or volume needs to exist beforehand. Removing entries does not drop access rights, this must be done manually or via the custom resource.

Other attributes include:
- node['gluster']['server']['enable'] - enable or disable server service (default enabled)
- node['gluster']['server']['server_extend_enabled'] - enable or disable server extending support (default enabled)
- node['gluster']['server']['brick_mount_path'] - default path to use for mounting bricks
- node['gluster']['server']['disks'] - an array of disks to create partitions on and format for use with Gluster, (for example, ['/dev/sdb', '/dev/sdc'])
- node['gluster']['server']['peer_retries'] - attempt to connect to peers up to N times
- node['gluster']['server']['peer_retry_delays'] - number of seconds to wait between attempts to initially attempt to connect to peers
- node['gluster']['server']['volumes'][VOLUME_NAME]['allowed_hosts'] - an optional array of IP addresses to allow access to the volume
- node['gluster']['server']['volumes'][VOLUME_NAME]['peer_names'] - an optional array of Chef node names for peers used in the volume
- node['gluster']['server']['volumes'][VOLUME_NAME]['peers'] - an array of FQDNs for peers used in the volume
- node['gluster']['server']['volumes'][VOLUME_NAME]['quota'] - an optional disk quota to set for the volume, such as '10GB'
- node['gluster']['server']['volumes'][VOLUME_NAME]['replica_count'] - the number of replicas to create
- node['gluster']['server']['volumes'][VOLUME_NAME]['volume_type'] - the volume type to use; this value can be 'replicated', 'distributed-replicated', 'distributed', 'striped' or 'distributed-striped'
- node['gluster']['server']['volumes'][VOLUME_NAME]['size'] - The size of the gluster volume you would like to create, for example, 100M or 5G. This is passed through to the lvm cookbook.
- node['gluster']['server']['volumes'][VOLUME_NAME]['filesystem'] - The filesystem to use. This defaults to xfs.
- node['gluster']['server']['volumes'][VOLUME_NAME]['options'] - Optional options to configure on volume

Custom Resources

gluster_mount

Use this resource to mount volumes on clients:

gluster_mount 'volume_name' do
  server 'gluster1.example.com'
  backup_server 'gluster2.example.com'
  mount_point '/mnt/gluster/volume_name'
  action [:mount, :enable]
end
gluster_mount 'volume_name' do
  server 'gluster1.example.com'
  backup_server ['gluster2.example.com', 'gluster3.example.com']
  mount_point '/mnt/gluster/volume_name'
  action [:mount, :enable]
end

Parameters

  • server - The primary server to fetch the volfile from. Required.

  • backup_server - Backup servers to obtain the volfile from. Optional.

  • mount_point - The mount point on the local server to mount the glusterfs volume on. Created if non-existing. Required.

  • mount_options - Additional mount options added to the default options set defaults,_netdev. Optional.

  • owner - Owner of the underlying mount point directory. Defaults to nil. Optional.

  • group - Group of the underlying mount point directory. Defaults to nil. Optional.

  • mode - File mode of the underlying mount point directory. Defaults to nil. Optional.

gluster_volume_option

Use this resource to set or reset volume options:

gluster_volume_option 'volume_name/changelog.rollover-time' do
  value 5
  action :set
end
gluster_volume_option 'volume_name/changelog.rollover-time' do
  action :reset
end

Parameters

  • key - Volume option to change. Required. Derived from after the / of resource name if not given.
  • value - The value to set for the given option. Required for the set action. Booleans are mapped to on or off.
  • volume - Volume to chnage. Required. Derived from before the / of resource name if not given.

gluster_mountbroker_user

Use this resource to allow or disallow the given user access to the given volume:

gluster_mountbroker_user 'user/volume_name' do
  action :add
end
gluster_mountbroker_user 'user/volume_name' do
  action :remove
end

Parameters

  • user - The user to grant permission to. Required. Derived from before the / of resource name if not given.
  • volume - The volume to grant the permission for. Required. Derived from after the / of resource name if not given.

Usage

On two or more identical systems, attach the desired number of dedicated disks to use for Gluster storage. Add the gluster::server recipe to the node's run list and add any appropriate attributes, such as volumes to the ['gluster']['server']['volumes'] attribute. If the cookbook will be used to manage disks, add the disks to the ['gluster']['server']['disks'] attribute; otherwise format the disks appropriately and add them to the ['gluster']['server']['volumes'][VOLUME_NAME]['disks'] attribute. Once all peers for a volume have configured their bricks, the 'master' peer (the first in the array) will create and start the volume.

For example, to create a replicated gluster volume named gv0 with 2 bricks on two nodes, add the following to your attributes/default.rb and include the gluster::server recipe:

default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
                'gv0' => {
                        'peers' => ['gluster1.example.com','gluster2.example.com'],
                        'replica_count' => 2,
                        'volume_type' => "replicated"
                }
}

To create a distributed-replicated volume with 4 bricks and a replica count of two:

default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
                'gv0' => {
                        'peers' => ['gluster1.example.com','gluster2.example.com','gluster3.example.com','gluster4.example.com'],
                        'replica_count' => 2,
                        'volume_type' => "distributed-replicated"
                }
}

To create a replicated volume with 4 bricks:

default['gluster']['server']['brick_mount_path'] = "/data"
default['gluster']['server']['volumes'] = {
                'gv0' => {
                        'peers' => ['gluster1.example.com','gluster2.example.com','gluster3.example.com','gluster4.example.com'],
                        'replica_count' => 4,
                        'volume_type' => "replicated"
                }
}

For clients, add the gluster::default or gluster::client recipe to the node's run list, and mount volumes using the gluster_mount LWRP. The Gluster volume will be mounted on the next chef-client run (provided the volume exists and is available) and added to /etc/fstab.

This cookbook cannot currently perform all the steps required for geo-replication but it can configure the mountbroker. The gluster::mountbroker recipe calls upon the gluster::geo_replication_install recipe to install the necessary package before configuring the mountbroker according to the ['gluster']['mountbroker'] attributes. User access can be defined via the attributes or you can use the gluster_mountbroker_user custom resource directly. Both the recipe and resource require Gluster 3.9 or later.

Testing

There is a kitchen file provided to allow testing of the various versions. Examples of tests are:

(Depending on your shell, you may or may not need the \ in the RegEx)

To test a replicated volume on Ubuntu 16.04:
kitchen converge replicated[12]-ubuntu-1604
kitchen verify replicated2-ubuntu-1604

To test a distributed-replicated volume on CentOS 7.2:
kitchen converge distributed-repl[1234]-centos-72
kitchen verify distributed-repl4-centos-72

To test a striped volume on CentOS 6.8:
kitchen converge striped[12]-centos-68
kitchen verify striped2-centos-68

To test a fuse client on Ubuntu 14.04:
kitchen converge client[12]-ubuntu-1404
kitchen verify client2-ubuntu-1404

Please note that at present the kitchen setup only supports Virtualbox

Dependent cookbooks

apt >= 2.0
yum >= 3.0
lvm >= 1.5.1

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

gluster cookbook CHANGELOG

Unreleased

v5.3.0 (2017-01-03)

  • PR #82 - Add license and fix readme
  • PR #83 - Use GPG keys on yum repositories and Support 3.9 on yum via the buildlogs.centos.org testing repo
  • PR #84 - Allow disable of server extending support
  • PR #85 - Minor Debian and repository fixes
  • PR #86 - Add gluster_volume_option custom resource
  • PR #90 - Add parameters for volume_option to README
  • PR #91 - Allow specify options as attributes

v5.2.0 (2016-12-09)

  • PR #77 - Allow use gluster recipe on already existed filesystem
  • PR #78 - Allow customize brick directory by attribute
  • PR #79 - Fix gluster volume create force

v5.1.0 (2016-12-02)

  • PR #72 - Fix backup-volfile-server(s) in mount provider
  • PR #73 - Bump Travis ruby version to 2.3.1
  • PR #74 - Bump Gluster version to 3.8
  • PR #75 - Disable Metrics/BlockLength cop

v5.0.2 (2016-09-14)

  • PR #58 - Fix case statement syntax
  • PR #59 - Fix problems with volume_extend recipe
  • PR #61 - Update disk controller logic for Vagrant template
  • PR #62 - Fix undefined method error in server_extend recipe
  • PR #63 - Fix Ruby syntax per Rubocop
  • PR #66 - Update test-kitchen OS's
  • PR #67 - Fix serverspec verification
  • PR #68 - Add kitchen testing for gluster::client recipe
  • PR #69 - Update yum_repository resource

v5.0.1 (2016-03-12)

  • PR #52 - Correct the usage of the peer_names attribute
  • PR #53 - Fix spacing in case statement
  • PR #56 - Allow host check to match when hostname is listed under 'Other names'
  • PR #57 - Add source_url and issues_url to metadata

v5.0.0 (2016-02-03)

  • PR #44 - Fix brick_in_volume for long hostnames
  • PR #47 - Re-architecture of gluster cookbook to support multi-volume per peer, LVM, size declaration
  • PR #48 - Add Debian support
  • PR #51 - Update repo for Centos 6/7

v4.0.2 (2015-10-21)

  • PR #39 - Fix the client package name for rhel
  • PR #42 - Add owner/group/mode settings to gluster_mount LWRP
  • PR #41 - Allow mount options to be set on gluster mount

v4.0.1 (2015-09-30)

  • PR #28 - Add exception handling for peers not being nodes on chef server
  • PR #36 - Allow disabling of public Gluster repo
  • PR #37 - Fix default attribute value for ['gluster']['client']['volumes']
  • PR #37 - Add include for client_mount recipe in client recipe

v4.0.0 (2015-08-28)

  • PR #17 - Allow hostname for older versions of chef-server
  • PR #18 - Fix for initial Chef run for the first node in a cluster
  • PR #21 - Add ability to disable gluster server service
  • PR #22 - Fix Ruby syntax, add Rubocop, add Foodcritic, add TravisCI
  • PR #27 - Add glusterfsd service for shutdown cleanup on RHEL 7+
  • PR #24 - Wait until peer reaches connected status before continuing
  • PR #24 - Add striped, distributed, distributed-striped volume types
  • PR #24 - Fix chef node loading
  • PR #24 - Add server_extend recipe to allow for automatic gluster scaling

v3.1.0 (2015-07-09)

  • PR #6 - Allow to multiple backup servers when mounting a glusterfs volume
  • PR #7 - Add recursive true for dir creation under the lvm logic
  • PR #9 - Fix Ruby syntax on create partition bash block
  • PR #9 - Create a "servicename" attribute so that the service-hook actually starts the correctly named service.
  • PR #10 - Modify order of saving the bricks
  • PR #13 - Add peer_names attribute to volumes
  • PR #14 - Retry peering
  • PR #16 - Don't shadow bricks variable

v3.0.1 (2015-03-25)

  • PR #2 - Fix typo for brick_mount_path attribute
  • Relaxed brick count check for replicated volumes

v3.0.0 (2015-03-20)

  • Added a new gluster_mount LWRP
  • Deprecating gluster::client_mount recipe
  • Updated Ubuntu repo location

v2.1.1 (2015-02-17)

  • Added backup server option for gluster::client_mount

v2.1.0 (2014-08-29)

  • Initial commit

Collaborator Number Metric
            

5.3.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Foodcritic Metric
            

5.3.0 passed this metric

License Metric
            

5.3.0 passed this metric