Skip to content

Instantly share code, notes, and snippets.

@teaforthecat
Created December 1, 2013 00:00
Show Gist options
  • Save teaforthecat/7726307 to your computer and use it in GitHub Desktop.
Save teaforthecat/7726307 to your computer and use it in GitHub Desktop.
puppet-hiera hash data access fails why?
nfs_volumes:
home: "%{gdnet_env}-netapp1:/vol/home/qtree0"
yum_cache: "%{gdnet_env}-netapp1:/vol/yum_cache/qtree0"
techops: "%{gdnet_env}-netapp1:/vol/techops/qtree0"
websites: "%{gdnet_env}-netapp1:/vol/websites_%{gdnet_env}/qtree0"
apache_logs: "%{gdnet_env}-netapp1:/vol/apache_logs_%{gdnet_env}/qtree0"
evolution_logs: "%{gdnet_env}-netapp1:/vol/evolution_logs_%{gdnet_env}/qtree0"
define gd-mount::nfs (
$volumes = hiera_hash("nfs_volumes"),
$mount_path = undef,
$allow_mounts = hiera('allow_mounts')) {
# creates directory to mock nfs in development
$mount_state = $allow_mounts ? {
true => mounted,
false => unmounted,
debug => present, #enter into fstab but don't mount
}
# this fails because device in null, why?
$device = $volumes[$name]
unless $devise {
fail("Device is not set ${devise} for ${name} in ${volumes} ")
# => Error: Device is not set for websites in {"home"=>"dev-netapp1-ep.tops.gdi:/vol/home/qtree0", "yum_cache"=>"dev-netapp1-ep.tops.gdi:/vol/yum_cache/qtree0", "techops"=>"dev-netapp1-ep.tops.gdi:/vol/techops/qtree0", "websites"=>"dev-netapp1-ep.tops.gdi:/vol/websites_dev/qtree0", "apache_logs"=>"dev-netapp1-ep.tops.gdi:/vol/apache_logs_dev/qtree0", "evolution_logs"=>"dev-netapp1-ep.tops.gdi:/vol/evolution_logs_dev/qtree0"} at /tmp/vagrant-puppet/modules-0/gd-mount/manifests/nfs.pp:23 on node localhost.localdomain
}
file {$_mount_path:
ensure => directory,
}
->
mount {$_mount_path:
fstype => nfs,
ensure => $mount_state,
options => "soft,nosuid,tcp,noatime,vers=3",
atboot => "true", # enter into fstab
device => $device,
}
}
class role::staticweb {
include role::gd-base
gd-mount::nfs {"websites":
mount_path => "/NFS/netapp1-ep/websites_${environment}",
}
gd-mount::nfs {"nothing":
mount_path => "/NFS/netapp1-ep/nothing",
}
}
@benagricola
Copy link

Spelling error at line #15 of nfs.pp, $devise => $device, lookups like that should work fine.

@teaforthecat
Copy link
Author

omg thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment