summaryrefslogtreecommitdiffstats
path: root/manifests/params.pp
blob: d1113da76b5f07b633e4d77332ead9f8ac29fe50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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(
	# packages...
	$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_btrfsprogs = 'btrfs-progs',

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

	# programs...
	$program_gluster = '/usr/sbin/gluster',

	$program_modprobe = '/sbin/modprobe',
	$program_lsmod = '/sbin/lsmod',

	$program_parted = '/sbin/parted',
	$program_pvcreate = '/sbin/pvcreate',
	$program_vgcreate = '/sbin/vgcreate',
	$program_lvcreate = '/sbin/lvcreate',
	$program_vgs = '/sbin/vgs',
	$program_lvs = '/sbin/lvs',
	$program_pvdisplay = '/sbin/pvdisplay',
	$program_vgdisplay = '/sbin/vgdisplay',
	#$program_lvdisplay = '/sbin/lvdisplay',
	$program_xfsadmin = '/usr/sbin/xfs_admin',
	$program_mkfs_xfs = '/sbin/mkfs.xfs',
	$program_mkfs_ext4 = '/sbin/mkfs.ext4',
	$program_mkfs_btrfs = '/sbin/mkfs.btrfs',

	$program_fping = '/usr/sbin/fping',
	$program_findmnt = '/bin/findmnt',
	$program_awk = '/bin/awk',

	# SELinux
	$selinux_glusterd_seluser = 'system_u',

	# services...
	$service_glusterd = 'glusterd',

	# external modules...
	$include_puppet_facter = true,

	# misc...
	$misc_gluster_reload = '/sbin/service glusterd reload',
	$misc_gluster_repo = 'https://download.gluster.org/pub/gluster/glusterfs/',

	# the operatingsystemrelease string used in the repository URL.
	$misc_repo_operatingsystemrelease = "${operatingsystemrelease}",

	# comment...
	$comment = ''

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

	$valid_include_puppet_facter = $include_puppet_facter ? {
		true => true,
		false => false,
		'true' => true,
		'false' => false,
		default => true,
	}

	if $valid_include_puppet_facter {
		include puppet::facter
		$factbase = "${::puppet::facter::base}"
		$hash = {
			'gluster_program_gluster' => $program_gluster,
		}
		# create a custom external fact!
		file { "${factbase}gluster_program.yaml":
			content => inline_template('<%= @hash.to_yaml %>'),
			owner => root,
			group => root,
			mode => 644,		# u=rw,go=r
			ensure => present,
		}
	}
}

# vim: ts=8