Yep, thanks Patrick.

I've figure it out this way:
class dev_httpd {
   class dev_httpd_def_php_pkgs inherits php_mod {
     php_mod::php_mod_add {
       "php-pgsql":
         ensure => present,
         type  => "rpm";
   }
   class dev_httpd_preview_php_pkgs inherits dev_httpd_def_php_pkgs {
     Php_mod::Php_mod_add['php-pgsql'] { ensure => absent }
   }
}

then I include that on the node def like so:
node mel_default_preview inherits mel_default_web {
  class { httpd: version => "2.2.3-43.el5.centos.3" }
  class { php: version => "5.2.9-2" }
  include dev_httpd::dev_httpd_def_php_conf
  class { dev_httpd: }
  include dev_httpd::dev_httpd_def_php_pkgs
}
node au-mel-preview-1 inherits mel_default_preview {
  include dev_httpd::dev_httpd_preview_php_pkgs
}

That provides a bit of flexibility.

Thanks again for all your help.

Cheers
DenMat

On Sep 21, 4:36 pm, Patrick <[email protected]> wrote:
> On Sep 20, 2010, at 10:57 PM, denmat wrote:
>
> > Thanks for the swift response Patrick, however it hasn't worked.  If I
> > declare it in one place, it complains of a duplicate.
>
> > I'm thinking what I'm trying to do is not possible.
>
> class base
> {
>         package { "svn":
>                 ensure => installed,
>         }
>
> }
>
> class remove_svn inherits base
> {
>         #Look up overrides in
>         #http://docs.reductivelabs.com/guides/language_tutorial.html#classes
>         #This bit is the key
>         Package["svn"] {
>                 ensure => absent,
>         }
>
> }
>
> #Also important!
> include base
>
> node default
> {
>         #Commenting and uncommenting this next line will install and 
> uninstall the package.
> #       include remove_svn
>
> }
>
> > On Sep 21, 1:14 pm, Patrick <[email protected]> wrote:
> >> On Sep 20, 2010, at 8:01 PM, denmat wrote:
>
> >>> Hi List,
>
> >>> I have two questions.
>
> >>> Firstly I want to be able to ensure a default package is installed
> >>> across all hosts unless I specifically require them to be absent.
>
> >>> To do this I have created a module(httpd) and class(php_mod) and
> >>> definition(php_mod_add) which I want to declare at the default node or
> >>> individual node level.
>
> >> I believe you can do this by putting the "ensure => installed" resource in 
> >> a parent and have the child override it.  Then you include the child when 
> >> you want to remove the package.  Then include the parent in your global 
> >> section.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Puppet Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/puppet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to