Skip to content

Instantly share code, notes, and snippets.

@kornypoet
Last active August 29, 2015 14:04
Show Gist options
  • Save kornypoet/89dd08dff648fd383744 to your computer and use it in GitHub Desktop.
Save kornypoet/89dd08dff648fd383744 to your computer and use it in GitHub Desktop.
#
# init.pp
#
class foo(
$name = 'bob',
$age = 23,
$occupation = 'self-employed',
$job_description = 'nut scratcher'
) {
# Do init stuff
}
#
# install.pp
#
class foo::install(
# Inherit defaults from scoped module variables
# While allowing overrides
$occupation = $foo::occupation
) {
# Do install stuff
# Templates use local variables: just reassign them
$name = $foo::name
file { 'resume':
content => template('foo/resume.erb'),
}
# resume.erb
Name = <%= @name %>
Occupation = <%= @occupation %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment