Hi Timo,
there are two ways to achieve duplicate resource prevention:
1. virtual resources
migrate all packages which could be used by multiple classes into a separate class and mark them with the @-sign to be "virtual".
Virtual resources are not added to catalog onless you tell Puppet to realize or collect the resource.
Best practice is to provide information on when to manage the package via the "tag" metaparameter:
e.g.
site/profile/manifests/packages.pp
class profile::packages {
@package { 'foo':
ensure => present,
tag => ['web', 'db', 'storage'],
}
@package { 'bar':
ensure => present,
tag => ['db', 'storage'],
}
}
on the db, web, storage server profile add the collector for the required resource type:
class profile::db {
Package <| tag == 'db' |>
}
site/profile/manifests/web.pp
class profile::web {
Package <| tag == 'web' |>
}
site/profile/manifests/storage.pp
class profile::web {
Package <| tag == 'storage' |>
}
2nd option is to use the ensure_packages or ensure_resources function (I don't like this way as it hides what you want to achieve):
site/profile/manifests/db.pp
site/profile/manifests/db.pp
class profile::db {
ensure_packages(['foo', 'bar'], {ensure => present})
}
site/profile/manifests/web.pp
class profile::web {
ensure_packages('foo', {ensure => present})
}
site/profile/manifests/storage.pp
class profile::web {
ensure_packages(['foo', 'bar'], {ensure => present})
}
hth,
Martin
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
puppet-users...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/b690bc99-46cc-4130-b7ea-8f03442aa16d%40googlegroups.com.