Module glusterfs
In: /modules/glusterfs/manifests/volume.pp
/modules/glusterfs/manifests/server.pp
/modules/glusterfs/manifests/mount.pp
/modules/glusterfs/manifests/client.pp
/modules/glusterfs/manifests/peer.pp

# Overview

Install, enable and configure GlusterFS.

You will need to open TCP ports 24007:24009 and 38465:38466 on the servers.

# Example Usage

Complete server with two redundant nodes, on top of existing kickstart created vg0 LVM VGs. Note that the first runs will fail since the volume creation won‘t work until the peers know each other, and that requires the service to be running :

    file { [ '/export', '/export/gv0' ]:
        seltype => 'usr_t',
        ensure  => directory,
    }
    package { 'xfsprogs': ensure => installed }
    exec { 'lvcreate /dev/vg0/gv0':
        command => '/sbin/lvcreate -L 256G -n gv0 vg0',
        creates => '/dev/vg0/gv0',
        notify  => Exec['mkfs /dev/vg0/gv0'],
    }
    exec { 'mkfs /dev/vg0/gv0':
        command     => '/sbin/mkfs.xfs -i size=512 /dev/vg0/gv0',
        require     => [ Package['xfsprogs'], Exec['lvcreate /dev/vg0/gv0'] ],
        refreshonly => true,
    }
    mount { '/export/gv0':
        device  => '/dev/vg0/gv0',
        fstype  => 'xfs',
        options => 'defaults',
        ensure  => mounted,
        require => [ Exec['mkfs /dev/vg0/gv0'], File['/export/gv0'] ],
    }
    class { 'glusterfs::server':
        peers => $::hostname ? {
            'server1' => '192.168.0.2',
            'server2' => '192.168.0.1',
        },
    }
    glusterfs::volume { 'gv0':
        create_options => 'replica 2 192.168.0.1:/export/gv0 192.168.0.2:/export/gv0',
        require        => Mount['/export/gv0'],
    }

Client mount (the client class is included automatically). Note that clients are virtual machines on the servers above, so make each of them use the replica on the same hardware for optimal performance and optimal fail-over :

    file { '/var/www': ensure => directory }
    glusterfs::mount { '/var/www':
        device => $::hostname ? {
            'client1' => '192.168.0.1:/gv0',
            'client2' => '192.168.0.2:/gv0',
        }
    }

Defines

mount   peer   volume  

Classes and Modules

Class glusterfs::client
Class glusterfs::server

Defines

mount( $options => 'defaults', $device, $ensure => 'mounted' )

Define: glusterfs::mount

Manage client-side GlusterFS mounts.

Example Usage:

 glusterfs::mount { '/var/www':
     device => '192.168.12.1:/gv0',
 }
peer( )

Define: glusterfs::peer

Simple "gluster peer probe" wrapper. Peers only need to be added on one end. Use the $peers option to the glusterfs::server class instead of this definition directly.

volume( $create_options )

Define: glusterfs::volume

Simple way to create (not modify) and start GlusterFS volumes.

Example Usage:

 glusterfs::volume { 'gv0':
     create_options => 'replica 2 192.168.0.1:/export/gv0 192.168.0.2:/export/gv0',
 }

[Validate]