Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Pull operating system specific data from yaml files.
Browse files Browse the repository at this point in the history
This patch includes package names.
  • Loading branch information
purpleidea committed May 7, 2014
1 parent 36ee0eb commit 32fdb61
Show file tree
Hide file tree
Showing 29 changed files with 143 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "vagrant/gluster/puppet/modules/yum"]
path = vagrant/gluster/puppet/modules/yum
url = https://github.com/purpleidea/puppet-yum.git
[submodule "vagrant/gluster/puppet/modules/puppet-module"]
path = vagrant/gluster/puppet/modules/module-data
url = https://github.com/purpleidea/puppet-module-data.git
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Module specific notes:

Dependencies:
* puppetlabs-stdlib (required)
* puppet-module-data (optional, puppet >= 3.0.0)
* my puppet-common module (optional)
* my puppet-shorewall module (optional)
* my puppet-keepalived module (optional)
Expand Down
5 changes: 5 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# gluster/data/common.yaml
---
gluster::params::comment: 'Hello from @purpleidea!' # do not erase!

# vim: ts=8
9 changes: 9 additions & 0 deletions data/hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# gluster/data/hiera.yaml
---
:hierarchy:
- tree/%{::osfamily}/%{::operatingsystem}/%{::operatingsystemrelease}
- tree/%{::osfamily}/%{::operatingsystem}
- tree/%{::osfamily}
- common

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/Debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/Debian.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/Debian/Debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/Debian/Debian.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/Debian/Debian/7.4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/Debian/Debian/7.4.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/Debian/Ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/Debian/Ubuntu.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/Debian/Ubuntu/12.04.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/Debian/Ubuntu/12.04.yaml
---

# vim: ts=8
5 changes: 5 additions & 0 deletions data/tree/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# gluster/data/tree/RedHat.yaml
---
gluster::repo::base: 'https://download.gluster.org/pub/gluster/glusterfs/'

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/RedHat/CentOS.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/RedHat/CentOS.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/RedHat/CentOS/6.5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/RedHat/CentOS/6.5.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/RedHat/Fedora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/RedHat/Fedora.yaml
---

# vim: ts=8
4 changes: 4 additions & 0 deletions data/tree/RedHat/Fedora/20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gluster/data/tree/RedHat/Fedora/20.yaml
---

# vim: ts=8
4 changes: 3 additions & 1 deletion manifests/api.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
$repo = true, # are we using the automatic repo ?
$version = '' # pick a specific version (defaults to latest)
) {
include gluster::params

$rname = "${version}" ? {
'' => 'gluster',
default => "gluster-${version}",
}

package { 'glusterfs-api':
package { "${::gluster::params::package_glusterfs_api}":
ensure => "${version}" ? {
'' => present,
default => "${version}",
Expand Down
5 changes: 3 additions & 2 deletions manifests/brick.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
include gluster::again
}
include gluster::vardir
include gluster::params

#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
Expand Down Expand Up @@ -259,7 +260,7 @@
} elsif ( $valid_fstype == 'xfs' ) {
# exec requires
include gluster::brick::xfs
$exec_requires = [Package['xfsprogs']]
$exec_requires = [Package["${::gluster::params::package_xfsprogs}"]]

$xfs_arg00 = "/sbin/mkfs.${valid_fstype}"

Expand Down Expand Up @@ -343,7 +344,7 @@
} elsif ( $valid_fstype == 'ext4' ) {
# exec requires
include gluster::brick::ext4
$exec_requires = [Package['e2fsprogs']]
$exec_requires = [Package["${::gluster::params::package_e2fsprogs}"]]

# mkfs w/ uuid command
$mkfs_exec = "/sbin/mkfs.${valid_fstype} -U '${valid_fsuuid}' ${dev2}"
Expand Down
5 changes: 4 additions & 1 deletion manifests/brick/ext4.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class gluster::brick::ext4 {
package { 'e2fsprogs':

include gluster::params

package { "${::gluster::params::package_e2fsprogs}":
ensure => present,
}
}
Expand Down
5 changes: 4 additions & 1 deletion manifests/brick/xfs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class gluster::brick::xfs {
package { 'xfsprogs':

include gluster::params

package { "${::gluster::params::package_xfsprogs}":
ensure => present,
}
}
Expand Down
3 changes: 2 additions & 1 deletion manifests/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$password = '' # if empty, puppet will attempt to choose one magically
) {
include gluster::vardir
include gluster::params

#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
Expand Down Expand Up @@ -169,7 +170,7 @@
# NOTE: it's possible the cycle is a bug in puppet or a
# bug in the dependencies somewhere else in this module.
#require => File['/var/lib/glusterd/peers/'],
require => Package['glusterfs-server'],
require => Package["${::gluster::params::package_glusterfs_server}"],
}

# set state=
Expand Down
7 changes: 6 additions & 1 deletion manifests/mount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
$ip = '', # you can specify which ip address to use (if multiple)
$shorewall = false
) {
include gluster::params

#mount -t glusterfs brick1.example.com:/test /test
#include gluster::mount::base
#class { '::gluster::mount::base':
Expand Down Expand Up @@ -161,7 +163,10 @@
dump => '0', # fs_freq: 0 to skip file system dumps
pass => '0', # fs_passno: 0 to skip fsck on boot
require => [
Package[['glusterfs', 'glusterfs-fuse']],
Package[
["${::gluster::params::package_glusterfs}",
"${::gluster::params::package_glusterfs_fuse}"]
],
File["${long_name}"], # the mountpoint
Exec['gluster-fuse'], # ensure fuse is loaded!
],
Expand Down
6 changes: 4 additions & 2 deletions manifests/mount/base.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$version = '' # pick a specific version (defaults to latest)
) {
include gluster::vardir
include gluster::params
#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')

Expand All @@ -36,12 +37,13 @@
ensure_resource('gluster::repo', "${rname}", $params)
}

package { ['glusterfs', 'glusterfs-fuse']:
package { ["${::gluster::params::package_glusterfs}",
"${::gluster::params::package_glusterfs_fuse}"]:
ensure => "${version}" ? {
'' => present,
default => "${version}",
},
before => Package['glusterfs-api'],
before => Package["${::gluster::params::package_glusterfs_api}"],
require => $repo ? {
false => undef,
default => Gluster::Repo["${rname}"],
Expand Down
38 changes: 38 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GlusterFS module by James
# Copyright (C) 2010-2013+ James Shubin
# Written by James Shubin <james@shubin.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class gluster::params(
$package_glusterfs = 'glusterfs',
$package_glusterfs_fuse = 'glusterfs-fuse',
$package_glusterfs_server = 'glusterfs-server',
$package_glusterfs_api = 'glusterfs-api',

$package_e2fsprogs = 'e2fsprogs',
$package_xfsprogs = 'xfsprogs',

$package_python_argparse = 'python-argparse',
$package_python_lxml = 'python-lxml',
$package_fping = 'fping',

$comment = ''
) {
if "${comment}" == '' {
warning('Unable to load yaml data/ directory!')
}

}
# vim: ts=8
2 changes: 1 addition & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# if you leave this blank, we assume you want the latest version...
$version = ''
) {
$base = 'https://download.gluster.org/pub/gluster/glusterfs/'
$base = hiera('gluster::repo::base') # eg: 'https://download.gluster.org/pub/gluster/glusterfs/'

if "${version}" == '' {
# latest
Expand Down
9 changes: 5 additions & 4 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$FW = '$FW' # make using $FW in shorewall easier

include gluster::vardir
include gluster::params

#$vardir = $::gluster::vardir::module_vardir # with trailing slash
$vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
Expand All @@ -57,16 +58,16 @@
mode => 700, # u=rwx
backup => false, # don't backup to filebucket
ensure => present,
before => Package['glusterfs-server'],
before => Package["${::gluster::params::package_glusterfs_server}"],
require => File["${vardir}/"],
}

package { 'glusterfs-server':
package { "${::gluster::params::package_glusterfs_server}":
ensure => "${version}" ? {
'' => present,
default => "${version}",
},
before => Package['glusterfs-api'],
before => Package["${::gluster::params::package_glusterfs_api}"],
require => $repo ? {
false => undef,
default => Gluster::Repo["${rname}"],
Expand All @@ -89,7 +90,7 @@
group => root,
mode => 644,
#notify => Service['glusterd'], # TODO: ???
require => Package['glusterfs-server'],
require => Package["${::gluster::params::package_glusterfs_server}"],
}

# NOTE: this option can be useful for users of libvirt migration as in:
Expand Down
3 changes: 2 additions & 1 deletion manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
include gluster::again
}
include gluster::vardir
include gluster::params
include gluster::volume::base
if $ping {
include gluster::volume::ping
Expand Down Expand Up @@ -220,7 +221,7 @@
default => [
Service['glusterd'],
File["${vardir}/volume/create-${name}.sh"],
Package['fping'],
Package["${::gluster::params::package_fping}"],
File["${vardir}/xml.py"], # status check
Gluster::Brick[$valid_bricks],
Exec["gluster-volume-stuck-${name}"],
Expand Down
5 changes: 4 additions & 1 deletion manifests/volume/ping.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

class gluster::volume::ping {

package { 'fping': # for checking other bricks are up
include gluster::params

# for checking other bricks are up
package { "${::gluster::params::package_fping}":
ensure => present,
}
}
Expand Down
10 changes: 6 additions & 4 deletions manifests/xml.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

class gluster::xml {
include gluster::vardir
include gluster::params

package { 'python-argparse':
package { "${::gluster::params::package_python_argparse}":
ensure => present,
}

package { 'python-lxml': # for parsing gluster xml output
# for parsing gluster xml output
package { "${::gluster::params::package_python_lxml}":
ensure => present,
}

Expand All @@ -37,8 +39,8 @@
backup => false, # don't backup to filebucket
ensure => present,
require => [
Package['python-argparse'],
Package['python-lxml'],
Package["${::gluster::params::package_python_argparse}"],
Package["${::gluster::params::package_python_lxml}"],
File["${vardir}/"],
],
}
Expand Down
1 change: 1 addition & 0 deletions vagrant/gluster/puppet/modules/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MODULES := \
puppet-common \
puppet-gluster \
puppet-keepalived \
puppet-module-data \
puppet-puppet \
puppet-shorewall \
puppet-yum \
Expand Down
1 change: 1 addition & 0 deletions vagrant/gluster/puppet/modules/module-data
Submodule module-data added at 4b3ad1

0 comments on commit 32fdb61

Please sign in to comment.