Skip to content

Instantly share code, notes, and snippets.

@jsoriano
Created July 24, 2013 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsoriano/6071447 to your computer and use it in GitHub Desktop.
Save jsoriano/6071447 to your computer and use it in GitHub Desktop.
Concatenate arrays that are parameters of resources in puppet without the use of ruby code
class foo ($concatenate = []) {
class simple_resource {
exec { 'env':
command => 'env | sort',
path => '/usr/bin',
environment => ['FOO=bar'],
logoutput => true,
}
}
class complex_resource($extraenv) inherits simple_resource {
Exec['env'] {
environment +> $extraenv,
}
}
if $concatenate {
class { 'complex_resource': extraenv => $concatenate }
} else {
include simple_resource
}
}
class { 'foo': concatenate => ['FOO2=bar', 'FOO3=sadad'] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment