Skip to content

Instantly share code, notes, and snippets.

@dominics
Last active December 13, 2016 05:22
Show Gist options
  • Save dominics/3fbe8f2598116497242f36896b70e5a6 to your computer and use it in GitHub Desktop.
Save dominics/3fbe8f2598116497242f36896b70e5a6 to your computer and use it in GitHub Desktop.
Wrapping a class in a resource so it can be made virtual (i.e. datadog_agent::integrations::jenkins only included if datadog_agent is)
class profile::datadog::agent(
$ensure = 'present',
) {
class {
'datadog_agent':
puppet_run_reports => true;
}
# Realize wrapped integration classes
Profile::Datadog::Integration<| |>
}
define profile::datadog::integration(
$params = {}
) {
class {
"datadog_agent::integrations::$name":
* => $params;
}
}
class profile::jenkins() {
# [...]
@profile::datadog::integration {
'jenkins':
params => {
path => '/var/lib/jenkins'
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment