Skip to content

Commit

Permalink
Make puppet::facter optional.
Browse files Browse the repository at this point in the history
This can be set with hiera: gluster::params::include_puppet_facter can
be set to false or 'false' to make puppet::facter optional. The downside
is that setting gluster::params::program_gluster won't apply to facts.
  • Loading branch information
purpleidea committed Aug 4, 2014
1 parent 8da4002 commit 233529d
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
# 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/',
Expand All @@ -65,18 +68,28 @@
warning('Unable to load yaml data/ directory!')
}

include puppet::facter
$factbase = "${::puppet::facter::base}"
$hash = {
'gluster_program_gluster' => $program_gluster,
$valid_include_puppet_facter = $include_puppet_facter ? {
true => true,
false => false,
'true' => true,
'false' => false,
default => true,
}
# 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,

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,
}
}
}

Expand Down

0 comments on commit 233529d

Please sign in to comment.