Skip to content

Commit

Permalink
Added ability to configure custom (local) repository for installing r…
Browse files Browse the repository at this point in the history
…pm package
  • Loading branch information
Daniel van der Ende committed Jan 4, 2016
1 parent 17afdcd commit f3dd6de
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 61 deletions.
93 changes: 50 additions & 43 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,56 @@
# class { 'zookeeper': }
#
class zookeeper(
$id = '1',
$datastore = '/var/lib/zookeeper',
$id = '1',
$datastore = '/var/lib/zookeeper',
# datalogstore used to put transaction logs in separate location than snapshots
$datalogstore = undef,
$initialize_datastore = false,
$datalogstore = undef,
$initialize_datastore = false,
# fact from which we get public ip address
$client_ip = $::ipaddress,
$client_port = 2181,
$election_port = 2888,
$leader_port = 3888,
$log_dir = '/var/log/zookeeper',
$cfg_dir = '/etc/zookeeper/conf',
$user = 'zookeeper',
$group = 'zookeeper',
$java_bin = '/usr/bin/java',
$java_opts = '',
$pid_dir = '/var/run/zookeeper',
$pid_file = '$PIDDIR/zookeeper.pid',
$zoo_main = 'org.apache.zookeeper.server.quorum.QuorumPeerMain',
$client_ip = $::ipaddress,
$client_port = 2181,
$election_port = 2888,
$leader_port = 3888,
$log_dir = '/var/log/zookeeper',
$cfg_dir = '/etc/zookeeper/conf',
$user = 'zookeeper',
$group = 'zookeeper',
$java_bin = '/usr/bin/java',
$java_opts = '',
$pid_dir = '/var/run/zookeeper',
$pid_file = '$PIDDIR/zookeeper.pid',
$zoo_main = 'org.apache.zookeeper.server.quorum.QuorumPeerMain',
$log4j_prop = 'INFO,ROLLINGFILE',
$cleanup_sh = '/usr/share/zookeeper/bin/zkCleanup.sh',
$servers = [],
$observers = [],
$ensure = present,
$snap_count = 10000,
$cleanup_sh = '/usr/share/zookeeper/bin/zkCleanup.sh',
$servers = [],
$observers = [],
$ensure = present,
$snap_count = 10000,
# since zookeeper 3.4, for earlier version cron task might be used
$snap_retain_count = 3,
# interval in hours, purging enabled when >= 1
$purge_interval = 0,
$snap_retain_count = 3,
# interval in hours, purging enabled when > = 1
$purge_interval = 0,
# log4j properties
$rollingfile_threshold = 'ERROR',
$tracefile_threshold = 'TRACE',
$max_allowed_connections = 10,
$peer_type = 'UNSET',
$start_with = 'init.d',
$ensure_cron = true,
$service_package = 'zookeeperd',
$service_name = 'zookeeper',
$packages = ['zookeeper'],
$repo = undef,
$cdhver = undef,
$install_java = false,
$java_package = undef,
$min_session_timeout = undef,
$max_session_timeout = undef,
$manage_service = true,
$manage_systemd = true,
$rollingfile_threshold = 'ERROR',
$tracefile_threshold = 'TRACE',
$max_allowed_connections = 10,
$peer_type = 'UNSET',
$start_with = 'init.d',
$ensure_cron = true,
$service_package = 'zookeeperd',
$service_name = 'zookeeper',
$packages = ['zookeeper'],
$repo = undef,
$cdhver = undef,
$install_java = false,
$java_package = undef,
$min_session_timeout = undef,
$max_session_timeout = undef,
$manage_service = true,
$manage_systemd = true,
$reponame = undef,
$repourl = undef,
$repodescr = undef
) {

validate_array($packages)
Expand All @@ -80,7 +83,11 @@
repo_source => $repo,
cdhver => $cdhver,
install_java => $install_java,
java_package => $java_package
java_package => $java_package,
reponame => $reponame,
repourl => $repourl,
repodescr => $repodescr

}->
class { 'zookeeper::config':
id => $id,
Expand Down
36 changes: 21 additions & 15 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@
# Should not be included directly
#
class zookeeper::install(
$ensure = present,
$snap_retain_count = 3,
$cleanup_sh = '/usr/lib/zookeeper/bin/zkCleanup.sh',
$datastore = '/var/lib/zookeeper',
$user = 'zookeeper',
$start_with = 'init.d',
$ensure_cron = true,
$service_package = 'zookeeperd',
$packages = ['zookeeper'],
$repo_source = undef,
$cdhver = cdhver,
$install_java = false,
$java_package = undef
$ensure = present,
$snap_retain_count = 3,
$cleanup_sh = '/usr/lib/zookeeper/bin/zkCleanup.sh',
$datastore = '/var/lib/zookeeper',
$user = 'zookeeper',
$start_with = 'init.d',
$ensure_cron = true,
$service_package = 'zookeeperd',
$packages = ['zookeeper'],
$repo_source = undef,
$cdhver = cdhver,
$install_java = false,
$java_package = undef,
$reponame = undef,
$repourl = undef,
$repodescr = undef
) {
anchor { 'zookeeper::install::begin': }
anchor { 'zookeeper::install::end': }
Expand All @@ -48,8 +51,11 @@
'RedHat': {

class { 'zookeeper::repo':
source => $repo_source,
cdhver => $cdhver,
source => $repo_source,
cdhver => $cdhver,
reponame => $reponame,
repourl => $repourl,
repodescr => $repodescr
}

class { 'zookeeper::os::redhat':
Expand Down
38 changes: 35 additions & 3 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#

class zookeeper::repo(
$source = undef,
$cdhver = undef,
$ensure = present,
$source = undef,
$cdhver = undef,
$ensure = present,
$reponame = undef,
$repourl = undef,
$repodescr = undef
) {

if $source {
Expand Down Expand Up @@ -76,6 +79,35 @@
}
}
}
'custom':{
if $repodescr == undef or $repourl == undef or $reponame == undef {
fail("Invalid parameter settings for custom repo")
}
$osrel = $::operatingsystemmajrelease
case $osrel {
'6', '7': {
# parameter ensure is not supported before Puppet 3.5
if versioncmp($::puppetversion, '3.5.0') >= 0 {
yumrepo { $reponame:
ensure => $ensure,
descr => $repodescr,
baseurl => $repourl,
enabled => 1,
sslverify => 0,
gpgcheck => 0
}
} else {
yumrepo { $reponame:
descr => $repodescr,
baseurl => $repourl,
enabled => 1,
sslverify => 0,
gpgcheck => 0
}
}
}
}
}
default: {
fail("\"${module_name}\" provides no repository information for yum repository \"${source}\"")
}
Expand Down

0 comments on commit f3dd6de

Please sign in to comment.